From: Elrond Date: Thu, 17 Jan 2013 22:50:51 +0000 (+0100) Subject: Fix linking to comments. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7d16a01baea3251aaecf1aaba519b6549fcf0b5f;p=mediagoblin.git Fix linking to comments. when linking to a comment in a MediaEntry, the page did not contain a because, well: We fetched a string comment-id from the routing. And the pagination code tried to compare that to the int id on the comment. Fix is to let routing fetch an int from the url. Easy. Relatedly remove duplicated comment_id fetching from the URL in the view. --- diff --git a/mediagoblin/user_pages/routing.py b/mediagoblin/user_pages/routing.py index a9431405..2b228355 100644 --- a/mediagoblin/user_pages/routing.py +++ b/mediagoblin/user_pages/routing.py @@ -37,7 +37,7 @@ add_route('mediagoblin.user_pages.user_gallery', 'mediagoblin.user_pages.views:user_gallery') add_route('mediagoblin.user_pages.media_home.view_comment', - '/u//m//c//', + '/u//m//c//', 'mediagoblin.user_pages.views:media_home') add_route('mediagoblin.user_pages.atom_feed', diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index d1ec23dc..dea47fbf 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -110,12 +110,13 @@ def media_home(request, media, page, **kwargs): """ 'Homepage' of a MediaEntry() """ - if request.matchdict.get('comment', None): + comment_id = request.matchdict.get('comment', None) + if comment_id: pagination = Pagination( page, media.get_comments( mg_globals.app_config['comments_ascending']), MEDIA_COMMENTS_PER_PAGE, - request.matchdict.get('comment')) + comment_id) else: pagination = Pagination( page, media.get_comments(