Branching from within view_handler
from pyramid.response import Response
from pyramid.httpexceptions import HTTPRedirection
from pyramid.httpexceptions import HTTPFound
class MyViewHandler(object):
__autoexpose__ = None
def __init__(self, request):
self.request = request
@action(renderer='/index.mako')
def index(self):
if test():
return {}
elif test2():
return Response('good stuff')
elif test3():
return HTTPRedirection(location='http://localhost/index3')
else:
return HTTPFound(location='http://localhost/index4')
In Pylons I could conditionally branch based on GET versus POST, where
the URL would be identical. I would transform the data from a POST
into a modified URL and redirect. I can't seem to accomplish the same
thing here within Pyramid.
The Response works, but not HTTPRedirection or HTTPFound.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.