Here is the handler setup.
config.add_handler('wrapper','/test_wrapper/{action}',handler=TestWrapper)
config.add_handler('wrapped','/test_wrapper/{action}',handler=TestWrapper)
Here is the handler code:
class TestWrapper(BaseView):
@action(name='wrapper',renderer='string',permission='__no_permission_required__')
def wrapper(self):
#Use who_api to perform LDAP login.
resp = self.request.wrapped_response
return Response('From wrapped = %s'%resp)
@action(name='wrapped',renderer='string',permission='__no_permission_required__',wrapper='wrapper')
def wrapped(self):
return Response('From wrapped')
class BaseView(object):
__autoexpose__= None
def __init__(self,request):
self.request = request
Browsing to : http://<server:port>/test_wrapper/wrapped results in
|*ValueError: No wrapper view named 'wrapper' found when executing view
named ''*
Browsing to http://<server:port>/test_wrapper/wrapper| *
|AttributeError: 'Request' object has no attribute 'wrapped_response'|*
I don't know if I am down the right path ehre but what I am really
interested in is the capability to call a view from within another view.
I am looking for capability to have a generic view which invokes views
based on query string parameter and returns response from the inner view
back. Just to add the generic view would be called as an Ajax request.
Thanks,
Jay
On 9/12/11 3:27 AM, Michael Merickel wrote:
1) What url are you visiting when you get the error?
2) There are no routes in play here, so I can't tell if your talk of
using pyramid_handlers is a red herring, or the actual problem. Can
you elaborate? And to clarify why I care, render_view_to_response (the
underlying code behind wrapping views) only works with traversal.
--
Michael
--
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.
--
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.