[Twisted-web] Chatola broken / bug in Athena?

kgi iacovou at gmail.com
Fri Jul 13 08:32:39 EDT 2007


On Thursday 12 July 2007 07:58:30 glyph at divmod.com wrote:
> Any updates you would like to make to the athena and nevow wiki pages
> would be appreciated.  They are sorely in need of some maintenance,
> whether they mention this *particular* fact or not :).

Glyph, I thought I'd mention that I spent a few hours yesterday and today 
creating a few new introductory Nevow pages on trac:

  http://divmod.org/trac/wiki/DivmodNevow/Tutorial
  http://divmod.org/trac/wiki/DivmodNevow/TutorialTwo
  http://divmod.org/trac/wiki/DivmodNevow/TutorialThree
  http://divmod.org/trac/wiki/DivmodNevow/TutorialFour
  http://divmod.org/trac/wiki/DivmodNevow/TutorialFive
  http://divmod.org/trac/wiki/DivmodNevow/TutorialSix

I know the names aren't inspired, but I guess the content can always be moved 
later.

The motivation was really that whenever I haven't done any Nevow for a while I 
often find that I've forgotten how to do a particular basic thing; I wanted a 
set of clean, small pages to get me back up to speed.

I thought I might as well go the extra mile and make it simpler with complete 
cut-and-pasteable, runnable examples. The emphasis is therefore on working 
code with a quick summary of "things to note" at the bottom.

One of the things I found when I was originally learning about Nevow is that 
the documentation tended to focus on the "Oooh! Cool Features!" aspect before 
the basics had even been covered.

For example, the document nevow-intro.txt talks about XML on-disk templates, 
data/render methods, Stan, formless, webform and Athena. Now, I'm not saying 
that it's a worthless document; far from it: it's a valuable reference, but 
it doesn't live up to what it's billed as: "An introductory guide covering 
Nevow basics".

I'd like some feedback on the style and the level at which it's pitched. I'd 
also like to know if there are some techniques that are plain wrong in modern 
Nevow. If it's generally liked, I'll try and do some more on Nevow and a few 
on Athena.

Lastly, I've got a few questions that popped up while I was writing these 
pages:

1. Is it possible to have a root resource that has an overridden locateChild() 
method AND can render its own content?

If I examine the segments for ('',) to trap the '/' URL and return self from 
locateChild(), then locateChild() simply gets called again and recursion sets 
in (in other words, self.docFactory is never examined).

If I examine the segments for ('',) and return *another( page object, that is 
mostly satisfactory, but I still need another class definition;

I found a mention somewhere that defining 'child_()' somewhere would handle 
the '/' resource. However, that would only work if I didn't override 
locateChild(), since it's locateChild() that actually does all the child 
lookups, in which case I'd lose the flexibility of locateChild().

2. What is the blessed, current, best way of performing a URL redirect? I have 
found several methods on the ML and in the codebase and I'd like a definitive 
answer.

Cheers,

Ricky





More information about the Twisted-web mailing list