X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/7c20a2661d532fe1e338f0f0dfb9fe42113ab103..570a60f8364dbd148fbd7b903a4422acbba6dfbc:/floof/lib/base.py?ds=sidebyside diff --git a/floof/lib/base.py b/floof/lib/base.py index 169493c..b42d2be 100644 --- a/floof/lib/base.py +++ b/floof/lib/base.py @@ -3,8 +3,9 @@ Provides the BaseController class for subclassing. """ from pylons.controllers import WSGIController +from pylons.controllers.util import abort, redirect from pylons.templating import render_mako as render -from pylons import config, session, tmpl_context as c +from pylons import config, request, session, tmpl_context as c from routes import request_config from floof import model @@ -34,3 +35,11 @@ class BaseController(WSGIController): return WSGIController.__call__(self, environ, start_response) finally: model.Session.remove() + + + def redirect_to_referrer(self): + """Performs a redirect_to to wherever we came from. Used for stuff + like logging in. + """ + referrer = request.headers.get('REFERER', '/') + redirect(referrer, code=302)