diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-05 15:36:51 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-05 15:36:51 -0500 |
commit | a7fcc027aa5f3f080a288eedeb5d153ca71a53d7 (patch) | |
tree | 3a464904b2c4420b4f239be411e755ba80498a32 /mediagoblin/util.py | |
parent | cb9bac0c83b7dd6d9153fc153b7282c26fe466f6 (diff) | |
parent | 9150244afa45628dd752a67272129d30d6c72224 (diff) | |
download | mediagoblin-a7fcc027aa5f3f080a288eedeb5d153ca71a53d7.tar.lz mediagoblin-a7fcc027aa5f3f080a288eedeb5d153ca71a53d7.tar.xz mediagoblin-a7fcc027aa5f3f080a288eedeb5d153ca71a53d7.zip |
Merge remote branch 'remotes/elrond/idea/shortcuts'
Diffstat (limited to 'mediagoblin/util.py')
-rw-r--r-- | mediagoblin/util.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mediagoblin/util.py b/mediagoblin/util.py index b675662e..cbb937ee 100644 --- a/mediagoblin/util.py +++ b/mediagoblin/util.py @@ -29,6 +29,7 @@ from babel.localedata import exists import jinja2 import translitcodec from paste.deploy.loadwsgi import NicerConfigParser +from webob import Response, exc from mediagoblin import globals as mgoblin_globals from mediagoblin.db.util import ObjectId @@ -117,6 +118,16 @@ def clear_test_template_context(): TEMPLATE_TEST_CONTEXT = {} +def render_to_response(request, template, context): + """Much like Django's shortcut.render()""" + return Response(render_template(request, template, context)) + + +def redirect(request, *args, **kwargs): + """Returns a HTTPFound(), takes a request and then urlgen params""" + return exc.HTTPFound(location=request.urlgen(*args, **kwargs)) + + def setup_user_in_request(request): """ Examine a request and tack on a request.user parameter if that's |