From 2d62e9efd210becd30982e65e06a6ef97029b391 Mon Sep 17 00:00:00 2001 From: lora Date: Sat, 19 Nov 2011 17:00:25 -0600 Subject: [PATCH] issue 582: use media.slug instead of media.id --- mediagoblin/decorators.py | 3 +-- mediagoblin/templates/mediagoblin/user_pages/media.html | 4 ++-- .../mediagoblin/user_pages/media_confirm_delete.html | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index 19e22bca..38f52ced 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -58,7 +58,7 @@ def user_may_delete_media(controller): """ def wrapper(request, *args, **kwargs): uploader = request.db.MediaEntry.find_one( - {'_id': ObjectId(request.matchdict['media'])}).uploader() + {'slug': request.matchdict['media'] }).uploader() if not (request.user['is_admin'] or request.user['_id'] == uploader['_id']): return exc.HTTPForbidden() @@ -95,7 +95,6 @@ def get_user_media_entry(controller): if not user: return render_404(request) - media = request.db.MediaEntry.find_one( {'slug': request.matchdict['media'], 'state': 'processed', diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 433f74dc..5e1b73de 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -124,7 +124,7 @@

{% set edit_url = request.urlgen('mediagoblin.edit.edit_media', user= media.uploader().username, - media= media._id) %} + media= media.slug) %} @@ -133,7 +133,7 @@

{% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', user= media.uploader().username, - media= media._id) %} + media= media.slug) %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html index dd6923a9..f62082bd 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html @@ -23,7 +23,7 @@

-- 2.25.1