On Sat, Jul 25, 2009 at 1:05 PM, Colin Alston <[email protected]>wrote:
> > > 2009/7/25 Siegmund Führinger <[email protected]> > >> On Sat, Jul 25, 2009 at 10:06 AM, Colin Alston<[email protected]> >> wrote: >> > On Sat, Jul 25, 2009 at 9:04 AM, Michał Pasternak <[email protected] >> > >> > wrote: >> >> >> >> BTW, are there any URL dispatchers (like the one Django has) out there >> for >> >> Nevow? >> > >> > I really and truly hope not. >> >> why not? urls are very important and using child_XXX methods is >> sometimes not very convinient. > > > Convenience at the cost of maintainability is not worth it. > FWIW, you can subclass your page objects to create more generic ways to deal with REST like arguments, as well as child page dispatch. This is what I do in Enamel: http://open.thusa.co.za/enamel/browser/trunk/enamel/pages.py#L68 http://open.thusa.co.za/enamel/browser/trunk/enamel/pages.py#L47 Then you can mix the page object appropriately and do something like class FooPage(rend.Page): # Whatever... class MyPage(pages.Standard): childPages = { 'Foo' : FooPage } arbitraryArguments = True def render_foo(self, c, d): return c.tag[ "You passed ", self.arguments[0], "instead of 'Foo'" ] HTH
_______________________________________________ Twisted-web mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
