f#435 - avoids linking to unprocessed media in prev and next

This commit is contained in:
Caleb Forbes Davis V 2011-07-05 21:33:02 -05:00
parent 5ed4722de8
commit ce2ac48826

View File

@ -148,7 +148,8 @@ class MediaEntry(Document):
Provide a url to the previous entry from this user, if there is one
"""
cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']},
'uploader': self['uploader']}).sort(
'uploader': self['uploader'],
'state': 'processed'}).sort(
'_id', DESCENDING).limit(1)
if cursor.count():
@ -161,7 +162,8 @@ class MediaEntry(Document):
Provide a url to the next entry from this user, if there is one
"""
cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']},
'uploader': self['uploader']}).sort(
'uploader': self['uploader'],
'state': 'processed'}).sort(
'_id', ASCENDING).limit(1)
if cursor.count():