Added parameter ascending to MediaEntry::get_comments, if true, comments

will be ordered ascending, otherwise descending
This commit is contained in:
Pablo J. Urbano Santos 2011-11-19 19:11:42 +01:00
parent 53bc39755b
commit e62fc61194

View File

@ -217,9 +217,14 @@ class MediaEntry(Document):
'created': datetime.datetime.utcnow,
'state': u'unprocessed'}
def get_comments(self):
def get_comments(self, ascending=False):
if ascending:
order = ASCENDING
else:
order = DESCENDING
return self.db.MediaComment.find({
'media_entry': self._id}).sort('created', DESCENDING)
'media_entry': self._id}).sort('created', order)
def get_display_media(self, media_map,
fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER):