[Twisted-Python] how to use --index= and doc vagueness

Donovan Preston dp at twistedmatrix.com
Fri May 9 01:55:40 EDT 2003


On Thursday, May 8, 2003, at 07:00 PM, Mukhsein Johari wrote:

> As it is, mozilla times out with some kind of strange redirection 
> error if I
> don't have index or index.html

This is a weird bug with the interaction of page.Page (which I assume 
you are using) and --resource-script. If you create your resource and 
then set the addSlash attribute to 0 it should help solve it:

resource = page.Page("hello", templateFile="SomeTemplate.html")
resource.addSlash = 0

Basically, Page by default tries to redirect to the same url with a 
slash at the end, but when a Page is the root resource the test that 
tests to see if there is a slash is never True.

Thomas Raschbacher had this problem before, I should have fixed this 
properly earlier. Sorry about it.

> Using the --resource-script=index.rpy (that's what I call the default 
> .rpy
> file) option and placing the index.rpy file in public_html does not 
> work.
> Twisted complains about not find the file even though it's in the very
> directory that it normally finds html and rpy files.

The file you specify as the --resource-script should be either a full, 
absolute path or a relative path to the file from the directory you run 
mktap in (I believe.)

Also, I believe --resource-script and --path are mutually exclusive. 
(I'm not totally sure though...) Using --resource-script will put the 
resource generated by the .rpy at the root of the Resource tree. Using 
--path will put a twisted.web.static.File pointing to the file or 
directory specified at the root of the Resource tree.

Donovan





More information about the Twisted-Python mailing list