aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/sql/models.py
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-09-21 13:02:35 +0200
committerJoar Wandborg <git@wandborg.com>2012-09-21 13:09:42 +0200
commit88a9662be4f97da5b04a3842c8d0caa2652be355 (patch)
tree1924afd6d94f4aa6932bb88feed150e9eae9fbe3 /mediagoblin/db/sql/models.py
parentd4c066abf017bc7af8fa30a25248dbae9e40355d (diff)
downloadmediagoblin-88a9662be4f97da5b04a3842c8d0caa2652be355.tar.lz
mediagoblin-88a9662be4f97da5b04a3842c8d0caa2652be355.tar.xz
mediagoblin-88a9662be4f97da5b04a3842c8d0caa2652be355.zip
Added client registration caps to OAuth plugin
THE MIGRATIONS SUPPLIED WITH THIS COMMIT WILL DROP AND RE-CREATE YOUR oauth__tokens AND oauth__codes TABLES. ALL YOUR OAUTH CODES AND TOKENS WILL BE LOST. - Fixed pylint issues in db/sql/migrations. - Added __repr__ to the User model. - Added _disable_cors option to json_response. - Added crude error handling to the api.tools.api_auth decorator - Updated the OAuth README. - Added client registration, client overview, connection overview, client authorization views and templates. - Added error handling to the OAuthAuth Auth object. - Added AuthorizationForm, ClientRegistrationForm in oauth/forms. - Added migrations for OAuth, added client registration migration. - Added OAuthClient, OAuthUserClient models. - Added oauth/tools with require_client_auth decorator method.
Diffstat (limited to 'mediagoblin/db/sql/models.py')
-rw-r--r--mediagoblin/db/sql/models.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py
index 5862f722..ccf03f32 100644
--- a/mediagoblin/db/sql/models.py
+++ b/mediagoblin/db/sql/models.py
@@ -85,6 +85,14 @@ class User(Base, UserMixin):
_id = SimpleFieldAlias("id")
+ def __repr__(self):
+ return '<{0} #{1} {2} {3} "{4}">'.format(
+ self.__class__.__name__,
+ self.id,
+ 'verified' if self.email_verified else 'non-verified',
+ 'admin' if self.is_admin else 'user',
+ self.username)
+
class MediaEntry(Base, MediaEntryMixin):
"""
@@ -362,12 +370,12 @@ class Collection(Base, CollectionMixin):
slug = Column(Unicode)
created = Column(DateTime, nullable=False, default=datetime.datetime.now,
index=True)
- description = Column(UnicodeText)
+ description = Column(UnicodeText)
creator = Column(Integer, ForeignKey(User.id), nullable=False)
items = Column(Integer, default=0)
get_creator = relationship(User)
-
+
def get_collection_items(self, ascending=False):
order_col = CollectionItem.position
if not ascending: