aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/decorators.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2015-09-17 13:47:56 +0200
committerJessica Tallon <tsyesika@tsyesika.se>2015-10-07 14:40:44 +0200
commit0f3bf8d4b180ffd1907d1578e087522aad7d9158 (patch)
tree22279f7ff895047d1ec3c68bedb69a081cc0871a /mediagoblin/decorators.py
parent80ba8ad1d1badb2f6330f25c540dc413e42e7d5c (diff)
downloadmediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.tar.lz
mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.tar.xz
mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.zip
Collection changes and migration for federation
- Adds a "type" column to the Collection object and allows the CollectionItem model to contain any object. - Changes "items" to "num_items" as per TODO - Renames "uploader", "creator" and "user" to a common "actor" in most places
Diffstat (limited to 'mediagoblin/decorators.py')
-rw-r--r--mediagoblin/decorators.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index d20aca10..952b4572 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -126,7 +126,7 @@ def user_may_delete_media(controller):
"""
@wraps(controller)
def wrapper(request, *args, **kwargs):
- uploader_id = kwargs['media'].uploader
+ uploader_id = kwargs['media'].actor
if not (request.user.has_privilege(u'admin') or
request.user.id == uploader_id):
raise Forbidden()
@@ -192,7 +192,7 @@ def get_user_media_entry(controller):
media = MediaEntry.query.filter_by(
id=int(media_slug[3:]),
state=u'processed',
- uploader=user.id).first()
+ actor=user.id).first()
except ValueError:
raise NotFound()
else:
@@ -200,7 +200,7 @@ def get_user_media_entry(controller):
media = MediaEntry.query.filter_by(
slug=media_slug,
state=u'processed',
- uploader=user.id).first()
+ actor=user.id).first()
if not media:
# Didn't find anything? Okay, 404.
@@ -225,7 +225,7 @@ def get_user_collection(controller):
collection = request.db.Collection.query.filter_by(
slug=request.matchdict['collection'],
- creator=user.id).first()
+ actor=user.id).first()
# Still no collection? Okay, 404.
if not collection:
@@ -274,7 +274,7 @@ def get_media_entry_by_id(controller):
return render_404(request)
given_username = request.matchdict.get('user')
- if given_username and (given_username != media.get_uploader.username):
+ if given_username and (given_username != media.get_actor.username):
return render_404(request)
return controller(request, media=media, *args, **kwargs)