aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/decorators.py
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2011-12-19 22:29:40 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2011-12-24 19:27:29 +0100
commit4deda94a380dc4217247b49df6e8a5bce0082ddc (patch)
treef973aac31b5f57b176b29617e7041bfb1e12198a /mediagoblin/decorators.py
parent4305580e8538e5523e9f621c3ffbed14a2ddc350 (diff)
downloadmediagoblin-4deda94a380dc4217247b49df6e8a5bce0082ddc.tar.lz
mediagoblin-4deda94a380dc4217247b49df6e8a5bce0082ddc.tar.xz
mediagoblin-4deda94a380dc4217247b49df6e8a5bce0082ddc.zip
Replace media.get_uploader()._id by media.uploader
media.get_uploader()._id loads a complete user object without actually needing it, because media.uploader already has the id!
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 229664d7..4cf14a70 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -57,10 +57,10 @@ def user_may_delete_media(controller):
Require user ownership of the MediaEntry to delete.
"""
def wrapper(request, *args, **kwargs):
- uploader = request.db.MediaEntry.find_one(
- {'_id': ObjectId(request.matchdict['media'])}).get_uploader()
+ uploader_id = 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)