[mod_python] get_cookies in servlet

Daniel Popowich dpopowich at comcast.net
Fri Aug 6 13:28:51 EDT 2004


Manera, Villiam writes:
> I added this code in prep():
>  
> def prep(self):
>     .....
>   cookies = self.get_cookies()
>   COOKIE_NAME = 'backgroundcolor'
>   if cookies.has_key(COOKIE_NAME):
>                  self.body_attrs['BGCOLOR']=cookies[COOKIE_NAME].value
>  
> in order to achieve what I wont I had to modify the servlet.py get_cookies:
>     def get_cookies(self, klass=Cookie.Cookie, **kw):
>         ...       
>      return Cookie.get_cookies(self.req, klass)
>      #return Cookie.get_cookies(self.req, klass, kw) <--- with kw :
>  
>    File "C:\PROGRA~1\Python23\lib\site-packages\mod_python\servlet.py", line
> 484, in get_cookies
>     return Cookie.get_cookies(self.req, klass, kw)
> 
> TypeError: get_cookies() takes at most 2 arguments (3 given)
>  

You found bug #2.  Going for the trifecta?  I have fixed this (as well
as the assertion bugs) and have placed a new version, 1.1.5, at:

    http://home.comcast.net/~d.popowich/mpservlets/

As for the feature request for js_links.  I like the idea, but I'm not
adding new functionality right now.  I'll add this to the list for the
next minor release.

Thanks!!

Daniel



More information about the Mod_python mailing list