[Twisted-web] Nevow URL trouble
Sridhar Ratna
sridharinfinity at gmail.com
Sat Feb 26 02:47:23 MST 2005
I am rewriting wsgi.py in nevow. I face some problems with the nevow
url module.
Firstly, only guard and rootaccessor uses IRequest.getRootURL()
In twisted the root url is always like http://domain.com/ . In
non-twisted setups like wsgi, it is not so. And well, nevow is
designed to work with cgi apps too (nevow-deployment.txt)
Consider this cgi/wsgi/nevow setup:
http://example.com/cgi-bin/nevowcgi.py/a/b/c
nevowcgi.py will createWSGIApplication and call run_with_cgi. The
wsgi.py module will then use the PATH_INFO environment variable for
request URI (IRequest.uri). Thus in the above example, IRequest.uri
is '/a/b/c'. wsgi.py in addition sets the appRootURL to
'http://example.com/cgi-bin/nevowcgi.py/' which is passed from
nevowcgi.py
Lot of code in nevow doesn't use the appRootURL. For example if
PageC.addSlash is True, the above url will be redirected to
http://example.com/a/b/c/ and not
http://example.com/cgi-bin/nevowcgi.py/a/b/c/ as expected (not the
leading slash)
Because of this reason, I couldn't get wsgi.py work fully. To fix
some problems (excluding the redirect problem) WSGIRequest.prePathURL
will return the full URL prefixed with appRootURL (which is not the
case with twisted.web.server.Request.prePathURL
--
Sridhar Ratna - http://srid.bsdnerds.org
More information about the Twisted-web
mailing list