aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2011-11-13 19:25:06 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2011-11-15 11:32:13 +0100
commiteabe6b678a98fd06d9cd8463935a3b842f41485c (patch)
tree9d8115df0629a5bbc9842c1616fed466371539e7 /mediagoblin/db/models.py
parent7cbddc96a85410c14583b598312e40efe6051a44 (diff)
downloadmediagoblin-eabe6b678a98fd06d9cd8463935a3b842f41485c.tar.lz
mediagoblin-eabe6b678a98fd06d9cd8463935a3b842f41485c.tar.xz
mediagoblin-eabe6b678a98fd06d9cd8463935a3b842f41485c.zip
Dot-Notation for "_id"
Note: Migrations can't use "Dot Notation"! Migrations run on pymongo, not mongokit. So they can't use the "Dot Notation". This isn't really a big issue, as migrations are anyway quite mongo specific.
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 65c15917..1c1bc2fd 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -219,7 +219,7 @@ class MediaEntry(Document):
def get_comments(self):
return self.db.MediaComment.find({
- 'media_entry': self['_id']}).sort('created', DESCENDING)
+ 'media_entry': self._id}).sort('created', DESCENDING)
def get_display_media(self, media_map,
fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER):
@@ -250,7 +250,7 @@ class MediaEntry(Document):
{'slug': self['slug']})
if duplicate:
- self['slug'] = "%s-%s" % (self['_id'], self['slug'])
+ self['slug'] = "%s-%s" % (self._id, self['slug'])
def url_for_self(self, urlgen):
"""
@@ -269,13 +269,13 @@ class MediaEntry(Document):
return urlgen(
'mediagoblin.user_pages.media_home',
user=uploader['username'],
- media=unicode(self['_id']))
+ media=unicode(self._id))
def url_to_prev(self, urlgen):
"""
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)
@@ -288,7 +288,7 @@ class MediaEntry(Document):
"""
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)