aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/decorators.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/decorators.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/decorators.py')
-rw-r--r--mediagoblin/decorators.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index b247e229..8f7532ec 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -60,7 +60,7 @@ def user_may_delete_media(controller):
uploader = request.db.MediaEntry.find_one(
{'_id': ObjectId(request.matchdict['media'])}).uploader()
if not (request.user['is_admin'] or
- request.user['_id'] == uploader['_id']):
+ request.user._id == uploader._id):
return exc.HTTPForbidden()
return controller(request, *args, **kwargs)
@@ -99,7 +99,7 @@ def get_user_media_entry(controller):
media = request.db.MediaEntry.find_one(
{'slug': request.matchdict['media'],
'state': 'processed',
- 'uploader': user['_id']})
+ 'uploader': user._id})
# no media via slug? Grab it via ObjectId
if not media:
@@ -107,7 +107,7 @@ def get_user_media_entry(controller):
media = request.db.MediaEntry.find_one(
{'_id': ObjectId(request.matchdict['media']),
'state': 'processed',
- 'uploader': user['_id']})
+ 'uploader': user._id})
except InvalidId:
return render_404(request)