aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
authorxray7224 <xray7224@googlemail.com>2013-07-08 20:35:03 +0100
committerxray7224 <jessica@megworld.co.uk>2013-07-11 18:21:43 +0100
commitd41c6a5349db0ac573e8f0d29d239febc705f7c9 (patch)
treed012264c2fbc093ea4da131206e40ca38d8c0584 /mediagoblin/db/models.py
parentbe7f90b3f537190d199989625f75d334dbca7080 (diff)
downloadmediagoblin-d41c6a5349db0ac573e8f0d29d239febc705f7c9.tar.lz
mediagoblin-d41c6a5349db0ac573e8f0d29d239febc705f7c9.tar.xz
mediagoblin-d41c6a5349db0ac573e8f0d29d239febc705f7c9.zip
Adds oauth support up until authorization
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py37
1 files changed, 33 insertions, 4 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index daee9295..8a71aa09 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -130,7 +130,36 @@ class Client(Base):
else:
return "<Client {0}>".format(self.id)
+class RequestToken(Base):
+ """
+ Model for representing the request tokens
+ """
+ __tablename__ = "core__request_tokens"
+ token = Column(Unicode, primary_key=True)
+ secret = Column(Unicode, nullable=False)
+ client = Column(Unicode, ForeignKey(Client.id))
+ user = Column(Integer, ForeignKey(User.id), nullable=True)
+ used = Column(Boolean, default=False)
+ authenticated = Column(Boolean, default=False)
+ verifier = Column(Unicode, nullable=True)
+ callback = Column(Unicode, nullable=True)
+ created = Column(DateTime, nullable=False, default=datetime.datetime.now)
+ updated = Column(DateTime, nullable=False, default=datetime.datetime.now)
+
+class AccessToken(Base):
+ """
+ Model for representing the access tokens
+ """
+ __tablename__ = "core__access_tokens"
+
+ token = Column(Unicode, nullable=False, primary_key=True)
+ secret = Column(Unicode, nullable=False)
+ user = Column(Integer, ForeignKey(User.id))
+ request_token = Column(Unicode, ForeignKey(RequestToken.token))
+ created = Column(DateTime, nullable=False, default=datetime.datetime.now)
+ updated = Column(DateTime, nullable=False, default=datetime.datetime.now)
+
class MediaEntry(Base, MediaEntryMixin):
"""
@@ -607,10 +636,10 @@ with_polymorphic(
[ProcessingNotification, CommentNotification])
MODELS = [
- User, Client, MediaEntry, Tag, MediaTag, MediaComment, Collection, CollectionItem,
- MediaFile, FileKeynames, MediaAttachmentFile, ProcessingMetaData,
- Notification, CommentNotification, ProcessingNotification,
- CommentSubscription]
+ User, Client, RequestToken, AccessToken, MediaEntry, Tag, MediaTag,
+ MediaComment, Collection, CollectionItem, MediaFile, FileKeynames,
+ MediaAttachmentFile, ProcessingMetaData, Notification, CommentNotification,
+ ProcessingNotification, CommentSubscription]
######################################################