Whitespace and formatting cleanup.
[mediagoblin.git] / mediagoblin / db / models.py
index 792a515ed0b764f8245fb2e75056d111541edda5..42db3f838d48f6a4b2b622c785094f1428f1ca59 100644 (file)
@@ -14,7 +14,8 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import datetime, uuid
+import datetime
+import uuid
 
 from mongokit import Document
 
 
 from mongokit import Document
 
@@ -69,15 +70,17 @@ class User(Document):
         'username': unicode,
         'email': unicode,
         'created': datetime.datetime,
         'username': unicode,
         'email': unicode,
         'created': datetime.datetime,
-        'plugin_data': dict, # plugins can dump stuff here.
+        'plugin_data': dict,  # plugins can dump stuff here.
         'pw_hash': unicode,
         'email_verified': bool,
         'status': unicode,
         'verification_key': unicode,
         'is_admin': bool,
         'pw_hash': unicode,
         'email_verified': bool,
         'status': unicode,
         'verification_key': unicode,
         'is_admin': bool,
-        'url' : unicode,
-        'bio' : unicode,     # May contain markdown
-        'bio_html': unicode, # May contain plaintext, or HTML
+        'url': unicode,
+        'bio': unicode,      # May contain markdown
+        'bio_html': unicode,  # May contain plaintext, or HTML
+        'fp_verification_key': unicode,  # forgotten password verification key
+        'fp_token_expire': datetime.datetime,
         }
 
     required_fields = ['username', 'created', 'pw_hash', 'email']
         }
 
     required_fields = ['username', 'created', 'pw_hash', 'email']
@@ -172,8 +175,8 @@ class MediaEntry(Document):
        critical to this piece of media but may be usefully relevant to people
        viewing the work.  (currently unused.)
 
        critical to this piece of media but may be usefully relevant to people
        viewing the work.  (currently unused.)
 
-     - fail_error: path to the exception raised 
-     - fail_metadata: 
+     - fail_error: path to the exception raised
+     - fail_metadata:
     """
     __collection__ = 'media_entries'
 
     """
     __collection__ = 'media_entries'
 
@@ -182,11 +185,11 @@ class MediaEntry(Document):
         'title': unicode,
         'slug': unicode,
         'created': datetime.datetime,
         'title': unicode,
         'slug': unicode,
         'created': datetime.datetime,
-        'description': unicode, # May contain markdown/up
-        'description_html': unicode, # May contain plaintext, or HTML
+        'description': unicode,  # May contain markdown/up
+        'description_html': unicode,  # May contain plaintext, or HTML
         'media_type': unicode,
         'media_type': unicode,
-        'media_data': dict, # extra data relevant to this media_type
-        'plugin_data': dict, # plugins can dump stuff here.
+        'media_data': dict,  # extra data relevant to this media_type
+        'plugin_data': dict,  # plugins can dump stuff here.
         'tags': [dict],
         'state': unicode,
 
         'tags': [dict],
         'state': unicode,
 
@@ -218,7 +221,8 @@ class MediaEntry(Document):
         return self.db.MediaComment.find({
                 'media_entry': self['_id']}).sort('created', DESCENDING)
 
         return self.db.MediaComment.find({
                 'media_entry': self['_id']}).sort('created', DESCENDING)
 
-    def get_display_media(self, media_map, fetch_order=DISPLAY_IMAGE_FETCHING_ORDER):
+    def get_display_media(self, media_map,
+                          fetch_order=DISPLAY_IMAGE_FETCHING_ORDER):
         """
         Find the best media for display.
 
         """
         Find the best media for display.
 
@@ -271,7 +275,7 @@ class MediaEntry(Document):
         """
         Provide a url to the previous entry from this user, if there is one
         """
         """
         Provide a url to the previous entry from this user, if there is one
         """
-        cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']},
+        cursor = self.db.MediaEntry.find({'_id': {"$gt": self['_id']},
                                           'uploader': self['uploader'],
                                           'state': 'processed'}).sort(
                                                     '_id', ASCENDING).limit(1)
                                           'uploader': self['uploader'],
                                           'state': 'processed'}).sort(
                                                     '_id', ASCENDING).limit(1)
@@ -284,7 +288,7 @@ class MediaEntry(Document):
         """
         Provide a url to the next entry from this user, if there is one
         """
         """
         Provide a url to the next entry from this user, if there is one
         """
-        cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']},
+        cursor = self.db.MediaEntry.find({'_id': {"$lt": self['_id']},
                                           'uploader': self['uploader'],
                                           'state': 'processed'}).sort(
                                                     '_id', DESCENDING).limit(1)
                                           'uploader': self['uploader'],
                                           'state': 'processed'}).sort(
                                                     '_id', DESCENDING).limit(1)
@@ -351,4 +355,3 @@ def register_models(connection):
     Register all models in REGISTER_MODELS with this connection.
     """
     connection.register(REGISTER_MODELS)
     Register all models in REGISTER_MODELS with this connection.
     """
     connection.register(REGISTER_MODELS)
-