[Twisted-web] Nevow with CGI - Using URLs in xml templates

Sridhar Ratna aka Srid sridharinfinity at gmail.com
Sun Feb 13 04:51:38 MST 2005

I am using [1]  Nevow in CGI environment

Both relative and absolute URLs cannnot be used in xml templates. 
Consider the following apache setup.

http://server/blog is rewritten (mod_rewrite) to

Now if an xml template contains this line
<link rel="stylesheet" href="styles/screen.css" type="text/css" />

without rewrite the URL the browser will see is 

and with rewritten the browser will see http://server/blog/styles/screen.css

This depends on the current page, so sometimes the browser will see
http://server/blog/2004/04/styles/screen.css (as the URL is relative).

To cope with this problem with url.URL generation, I remember the
parent-root URL in ctx.  But I feel this is difficult to do with
xml-templates as they are controlled by the user.  Is there anyway to
do translation in nevow?

[1] http://srid.bsdnerds.org/blog/2005/02/06/nevow-with-cgi-and-wsgi-adaptor/

Sridhar Ratna - http://srid.bsdnerds.org

More information about the Twisted-web mailing list