[Zope] reading cookies from external methods

Jed Parsons jedp at ilm.com
Fri Mar 31 15:04:43 EST 2006


Oh, cool.  That's kind of magical. :)

It looks like I can't get the RESPONSE that way, so if I want to do a 
RESPONSE.setCookie(...) somewhere, I have to pass REQUEST and RESPONSE 
as before, yes?

Thanks much,
j

Jonathan wrote:
> 
> ----- 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
> 
> 
> 

-- 
Jed Parsons       Industrial Light + Magic  (415) 746-2974
	
grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6))))}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));


More information about the Zope mailing list