aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/decorators.py
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-09-15 21:07:24 +0200
committerJoar Wandborg <git@wandborg.com>2012-09-15 21:07:24 +0200
commit3a1993288ffefe790208b719d6bd5ea42af79c49 (patch)
treefc763ca5194034172a7a18ad401f467414c9ba8f /mediagoblin/decorators.py
parent30520c92cc621bd0826259aca3d9b7b740f71ef0 (diff)
downloadmediagoblin-3a1993288ffefe790208b719d6bd5ea42af79c49.tar.lz
mediagoblin-3a1993288ffefe790208b719d6bd5ea42af79c49.tar.xz
mediagoblin-3a1993288ffefe790208b719d6bd5ea42af79c49.zip
Fixed ?next=<url> argument for require_active_login
It now includes the full URI, including GET args, not just the path.
Diffstat (limited to 'mediagoblin/decorators.py')
-rw-r--r--mediagoblin/decorators.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index 0eb1361d..9961be83 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -16,6 +16,9 @@
from functools import wraps
+from urlparse import urljoin
+from urllib import urlencode
+
from webob import exc
from mediagoblin.db.util import ObjectId, InvalidId
@@ -34,10 +37,16 @@ def require_active_login(controller):
request, 'mediagoblin.user_pages.user_home',
user=request.user.username)
elif not request.user or request.user.get('status') != u'active':
+ next_url = urljoin(
+ request.urlgen('mediagoblin.auth.login',
+ qualified=True),
+ request.url)
+
return exc.HTTPFound(
- location="%s?next=%s" % (
- request.urlgen("mediagoblin.auth.login"),
- request.full_path))
+ location='?'.join([
+ request.urlgen('mediagoblin.auth.login'),
+ urlencode({
+ 'next': next_url})]))
return controller(request, *args, **kwargs)