[Twisted-web] remove ugliness when creating Nevow sessions

Andrea Arcangeli andrea at cpushare.com
Thu Dec 15 16:45:48 MST 2005


On Wed, Dec 14, 2005 at 03:44:22PM +0100, Valentino Volonghi wrote:
> On Wed, Dec 14, 2005 at 02:21:54PM +0100, Andrea Arcangeli wrote:
> > The garbage is still there... patch is not applied, perhaps you're not
> > looking into trunk?
> 
>   1204         dp 
>   1104         dp     def locateChild(self, ctx, segments):
>   1104         dp         request = inevow.IRequest(ctx)
>   1908      glyph         # ctx.remember(self, ILoginManager)
>    565         dp         path = segments[0]
>   1498         dp         if self.useCookies:
>   1498         dp             cookie = request.getCookie(self.cookieKey)
>   1498         dp         else:
>   1498         dp             cookie = ''
>   2469         mg         request.setupSession = lambda : self.createSession(ctx, segments)
>   1908      glyph 
>    565         dp         if path.startswith(SESSION_KEY):
>    565         dp             key = path[len(SESSION_KEY):]
>    565         dp             if key not in self.sessions:
>   2469         mg                 return urlToChild(ctx, *segments[1:], **{'__start_session__':1}), ()
>    565         dp             self.sessions[key].setLifetime(self.sessionLifetime)
>    565         dp             if cookie == key:
>    565         dp                 # /sessionized-url/${SESSION_KEY}aef9c34aecc3d9148/foo
>    565         dp                 #                  ^
>    565         dp                 #                  we are this getChild
>    565         dp                 # with a matching cookie
>    565         dp                 self.sessions[key].sessionJustStarted = True
>   3148      glyph                 return urlToChild(ctx, *segments[1:]), ()
> 
> 
> This is enough to remove the weird url.
> What kind of clients are you using to still see the garbage on the
> URL? I don't see it anymore with safari, firefox, ie, konqueror and some
> others.
> 
> To enter the path with the garbage you would need to use an hand crafted
> sessionized url with a not existing session. Otherwise it won't be touched.
> Sincerely I don't think anybody will see this behaviour in action.
> 
> If you have some usecases we can change it though.

wget seems to work fine now, but why to leave other __start_session__ if
it's not needed? Or is it needed? Sorry to ask, but I never got the
point of all these __start_session__ in the code ;)

thanks!



More information about the Twisted-web mailing list