[Twisted-Python] Woven trailing slashes

Donovan Preston dp at twistedmatrix.com
Tue May 13 21:25:37 EDT 2003


On Tuesday, May 13, 2003, at 06:08 PM, Eric Holm wrote:

> I just installed 1.0.5, and now my Woven pages are sent
> to the browser with a trailing slash appended to the URL,
> which breaks all of the relative links.
>
> How do I get rid of the trailing slash?

If you are subclassing Page, you can add a class attribute addSlash = 
0, like this:

class Foo(page.Page):
	addSlash = 0


If you are still subclassing Controller, you can put the addSlash = 0 
there. Consider subclassing Page instead, as having a Model, View, 
Controller triad as the base of a Page will be deprecated in the near 
future.

If you're just using the generic Page instance, you can set it after 
creation like this:

resource = page.Page("foo")
resource.addSlash = 0

The default behavior of Woven is now to automatically add a slash 
because it makes creating relative links far easier, ironically ;-)

Donovan





More information about the Twisted-Python mailing list