Provide a source link so we can comply with the AGPL
[mediagoblin.git] / mediagoblin / decorators.py
index 229664d79cd2bc6963326c0d9c076dc3ca0a6a5f..83602c7063c1d3dd64fed18b2fe8a979c7e5b378 100644 (file)
@@ -1,5 +1,5 @@
 # GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 MediaGoblin contributors.  See AUTHORS.
+# Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -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)