
At the moment I have this URL working
/
/ter
/graph
I have an IndexPage(LivePage) with its
def child_ter(self, ctx): return TerPage()
def child_graph(self, ctx): return GraphPage()
mehods.
TerPage() an GraphPage() pick the firs element of a global list and show it in differents ways.
I'd like now to enalble urls like /ter/1, /ter/2, /ter/n so the n element of the list is picked instead of the first one. How is the correct way to make that argument reach TerPage and GraphPage instances?
Greets!

See "childFactory" and "locateChild" methods of rend.Page
BTW, are there any URL dispatchers (like the one Django has) out there for Nevow?

On Sat, Jul 25, 2009 at 9:04 AM, Michał Pasternak michal.dtz@gmail.comwrote:
BTW, are there any URL dispatchers (like the one Django has) out there for Nevow?
I really and truly hope not.

On Sat, Jul 25, 2009 at 10:06 AM, Colin Alstonkarnaugh@karnaugh.za.net wrote:
On Sat, Jul 25, 2009 at 9:04 AM, Michał Pasternak michal.dtz@gmail.com 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. having a central place to set up urls makes it also possible to "reverse"-construct urls. like "give me the url to method XXX, with args X,Y,Z" that makes it very easy to change urls later on without going through all templates.
Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

2009/7/25 Siegmund Führinger lists@0xx0.net
On Sat, Jul 25, 2009 at 10:06 AM, Colin Alstonkarnaugh@karnaugh.za.net wrote:
On Sat, Jul 25, 2009 at 9:04 AM, Michał Pasternak michal.dtz@gmail.com 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.
Trust me, if your project is going to reach any kind of size, you do NOT want "django esque" URL dispatchers. I've seen it go bad, I've experienced it go bad.

On Sat, Jul 25, 2009 at 1:05 PM, Colin Alston karnaugh@karnaugh.za.netwrote:
2009/7/25 Siegmund Führinger lists@0xx0.net
On Sat, Jul 25, 2009 at 10:06 AM, Colin Alstonkarnaugh@karnaugh.za.net wrote:
On Sat, Jul 25, 2009 at 9:04 AM, Michał Pasternak <michal.dtz@gmail.com
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

On Sat, Jul 25, 2009 at 1:05 PM, Colin Alstonkarnaugh@karnaugh.za.net wrote:
2009/7/25 Siegmund Führinger lists@0xx0.net
On Sat, Jul 25, 2009 at 10:06 AM, Colin Alstonkarnaugh@karnaugh.za.net wrote:
On Sat, Jul 25, 2009 at 9:04 AM, Michał Pasternak michal.dtz@gmail.com 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.
Trust me, if your project is going to reach any kind of size, you do NOT want "django esque" URL dispatchers. I've seen it go bad, I've experienced it go bad.
sorry i can't trust you on that one, because i am involved in a very big project at the moment. i'm not allowed to talk about it yet, but i is probably the biggest application of python in austria (ok, that is not really hard ;) ) and i wrote a similar service (but way not as large) with nevow's traditional way of dealing with urls. and this one is very hard to maintain, because the url system is not abstracted out of the code and templates. so maintainability IS the reason i use a django like url dispatch system. i'm not a native speaker so convenience was probably the wrong word to choose.
but it very much depends on the type of project. for some projects (also relatively large ones) it has been the right decision to stick with nevow's default way of handling urls.
Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Michał Pasternak wrote:
BTW, are there any URL dispatchers (like the one Django has) out there for Nevow?
I know of this one (hi Duncan!):
http://oubiwann.blogspot.com/2007/03/django-esque-url-resolution-in- nevow.html
Colin Alston wrote:
I really and truly hope not.
I hope you'll be able to sleep well tonight anyway. ;-P

2009/7/25 Michał Pasternak michal.dtz@gmail.com:
See "childFactory" and "locateChild" methods of rend.Page
I am reading at http://python.net/crew/mwh/nevowapi/nevow.rend.ChildLookupMixin.html
Is there an error in childFactory doc? It mentions the segment and request parameters which aren't there.
participants (5)
-
Colin Alston
-
Juanjo Conti
-
Michał Pasternak
-
Nicola Larosa
-
Siegmund Führinger