[Twisted-web] Re: [Nevow-commits] r740 - Refactor urlToChild API to avoid passing superfluous data (#1 from issue 121).

Tommi Virtanen tv at twistedmatrix.com
Sat Oct 23 01:57:32 MDT 2004

James Y Knight wrote:
>> Refactor urlToChild API to avoid passing superfluous data (#1 from 
>> issue 121).
> I believe this change is wrong: prePathURL() changes. setupSession has 
> to use the prePathURL in place when guard's locateChild() is called, not 
> the one in place at the time some other resource calls setupSession().

In theory, I believe you are right (and that particular patch can easily
be reverted without really affecting rest of the issue, it was

In practise, is request.setupSession really wanted? Noone seems to be
calling it, and commenting out the two lines that set it causes
no unit tests to fail.

I formally request you write unit tests for it if you want to keep it.
If you can write a test that fails due to changing prePathURL, I'll
happily make it work again.

[0 tv at tao ~/src/nevow/upstream]$ grapple setupSession
nevow/guard.py:186:        request.setupSession = lambda : 
self.createSession(request, segments=[])
nevow/guard.py:200:        request.setupSession = lambda : 
self.createSession(request, segments)
nevow/context.py:329:toSetOnRequest = ['args', 'content', 'fields', 
'isSecure', 'method', 'path', 'postpath', 'prepath', 
'receieved_headers', 'setupSession', 'session', 'uri']
examples/userdb.tac:312:    def setupSession(self, ctx):
examples/userdb.tac:318:        self.setupSession(ctx)
examples/userdb.tac:322:        self.setupSession(ctx)
# matches: 6
# matching-files: 3
[0 tv at tao ~/src/nevow/upstream]$

The examples/userdb.tac seems to be an unrelated function that just
happens to have the same name.

[0 tv at tao ~/src/twisted/stable]$ grapple setupSession
twisted/web/woven/guard.py:207:        request.setupSessionURL = setupURL
twisted/web/woven/guard.py:208:        request.setupSession = lambda: 
twisted/web/woven/guard.py:316:            return request.setupSession()
twisted/web/woven/guard.py:417:            return request.setupSession()
# matches: 4
# matching-files: 1
[0 tv at tao ~/src/twisted/stable]$

So woven calls it. Whoppee. I see no reason for nevow guard to try to be
compatible with woven guard.

More information about the Twisted-web mailing list