Replacing several request.matchdict['media'] -> media_slug ... shorter!
authorChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 26 Feb 2013 19:54:19 +0000 (13:54 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 26 Feb 2013 19:54:19 +0000 (13:54 -0600)
Thanks for pointing this out, Elrond ;)

This commit sponsored by Gerardo Joven Valdivia.  Thank you!

mediagoblin/decorators.py

index 14b4f8fc7ba97920186dd8622f8b7b6e519401e5..b6f6f9093816fc1a56aa0e4f0aa386931594427d 100644 (file)
@@ -130,7 +130,7 @@ def get_user_media_entry(controller):
         # might not be a slug, might be an id, but whatever
         media_slug = request.matchdict['media']
 
-        if u":" in request.matchdict['media']:
+        if u":" in media_slug:
             # okay, it's not actually a slug, it's some kind of identifier,
             # probably id:
             if media_slug.startswith(u'id:'):
@@ -144,7 +144,7 @@ def get_user_media_entry(controller):
         else:
             # no magical id: stuff?  It's a slug!
             media = MediaEntry.query.filter_by(
-                slug=request.matchdict['media'],
+                slug=media_slug,
                 state=u'processed',
                 uploader=user.id).first()