[Twisted-web] remove ugliness when creating Nevow sessions
Valentino Volonghi aka Dialtone
dialtone at divmod.com
Wed Dec 14 07:44:22 MST 2005
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.
--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20051214/e470130b/attachment.pgp
More information about the Twisted-web
mailing list