SESSION and REQUEST variables
I am storing a TransientObject based instance in a SESSION variable. What are my options for getting the REQUEST variable when calling methods on this instance from a page template? Looking at self.REQUEST doesn't seem to work and using 'python:obj.getData(request)' is very verbose. I would like 'obj/getData' to work, but it doesn't. Kevin Smith Kevin.Smith@theMorgue.org
While I'm not clear on exactly what you're doing (thus my answer might be less than helpful), I think you can get at your variable by doing something like (for instance): <span tal:define="myob python: request.SESSION['myob']"> ... </span> .. please proceed with telling me how that doesn't help. ;-) Kevin Smith wrote:
I am storing a TransientObject based instance in a SESSION variable. What are my options for getting the REQUEST variable when calling methods on this instance from a page template? Looking at self.REQUEST doesn't seem to work and using 'python:obj.getData(request)' is very verbose. I would like 'obj/getData' to work, but it doesn't.
Kevin Smith Kevin.Smith@theMorgue.org
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"
That would be the first part: getting the instance from the SESSION variable. Now I want to call a method on that instance which needs access to the REQUEST variable. <span tal:define="myob request/SESSION/myob; result myob/getData"></span> If the object were actually somewhere where acquisition could take over, I would be able to just use self.REQUEST, but it's just a transient object. On Tuesday, March 12, 2002, at 08:27 PM, Chris McDonough wrote:
While I'm not clear on exactly what you're doing (thus my answer might be less than helpful), I think you can get at your variable by doing something like (for instance):
<span tal:define="myob python: request.SESSION['myob']"> ... </span>
.. please proceed with telling me how that doesn't help. ;-)
Kevin Smith wrote:
I am storing a TransientObject based instance in a SESSION variable. What are my options for getting the REQUEST variable when calling methods on this instance from a page template? Looking at self.REQUEST doesn't seem to work and using 'python:obj.getData(request)' is very verbose. I would like 'obj/getData' to work, but it doesn't. Kevin Smith Kevin.Smith@theMorgue.org _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"
Kevin Smith Kevin.Smith@theMorgue.org
Chris McDonough wrote:
While I'm not clear on exactly what you're doing (thus my answer might be less than helpful), I think you can get at your variable by doing something like (for instance):
<span tal:define="myob python: request.SESSION['myob']">
and slightly cleaner: <span tal:define="myob nocall:request/SESSION/myob"> cheers, Chris
participants (3)
-
Chris McDonough -
Chris Withers -
Kevin Smith