X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/0ede26497a9e018cbd68e2f4120dcb44a21f4715..cb1976ef371904b45d7961212cd87595a9486284:/floof/lib/helpers.py?ds=sidebyside diff --git a/floof/lib/helpers.py b/floof/lib/helpers.py index c8a1251..b4cac1f 100644 --- a/floof/lib/helpers.py +++ b/floof/lib/helpers.py @@ -31,3 +31,13 @@ def get_object_or_404(model, **kw): abort(404) return obj +def get_comment_owner_url(**route): + """Given a view route, returns the owner_url route parameter for generating + comment URLs. + """ + if 'owner_url' in route: + # We're already in a comments page. Reuse the existing owner URL + return route['owner_url'] + + # url() returns URLs beginning with a slash. We just need to strip it. + return url(**route)[1:]