[Zope] reading cookies from external methods

Jonathan dev101 at magma.ca
Fri Mar 31 14:09:11 EST 2006


----- Original Message ----- 
From: "Jed Parsons" <jedp at ilm.com>
To: <zope at zope.org>
Sent: Friday, March 31, 2006 2:04 PM
Subject: [Zope] reading cookies from external methods


> 
> This is probably a silly question, but how does one read cookies from an 
> external method without passing REQUEST to the method?
> 
> The method should be callable both from dtml and from other external 
> methods.
> 
> I know I can do this:
> 
> def foo(REQUEST):
>     cookie = REQUEST.get('some_cookie')
>     return cookie


You just need to access REQUEST from within your external method, eg:

def foo(self, otherparms...)

   REQUEST = self.REQUEST
   cookie = REQUEST.get('some_cookie')


That should do it!

HTH

Jonathan



More information about the Zope mailing list