[mod_python] I: Too many cookies using mod_python 3.2.2b from mod_python-3.2.2b.win32-py2.4.exe

Jim Gallacher jg.lists at sympatico.ca
Wed Oct 26 17:22:48 EDT 2005


Manera, Villiam wrote:
> This for complete my previus message:
> Without  2 lines added in the beta release I still have only 1 cookie as before.
> 
> class BaseSession(dict):
> .........
>         if self._sid:
>             # attempt to load ourselves
>             self.lock()
>             if self.load():
>                 self._new = 0
>                 #if not req.headers_out.has_key("Set-Cookie"):
>                 #    Cookie.add_cookie(self._req, Cookie.Cookie(session_cookie_name, self._sid))
> 


OK, here is the story.

The two lines you've commented out were added to 3.2 to support some new 
session handling functionality. For various reasons that new 
functionality has been deferred until 3.3, but the new code was not 
removed. That should not be a problem, except that it is both buggy and 
wrong. :-(

It should look more like:

          if self._sid:
              # attempt to load ourselves
              self.lock()
              if self.load():
                  self._new = 0
                  # set a cookie if the source of self._sid was not a
                  # a cookie
                  if not cookies.has_key(session_cookie_name): 

                      Cookie.add_cookie(self._req, self.make_cookie())

self.make_cookie() takes care of your ApplicationPath problem. For the 
time being however, your solution (removing those 2 lines altogether) is 
the correct one.

This will be fixed for the 3.2 final release.

Regards,
Jim


More information about the Mod_python mailing list