[Twisted-web] Nevow: directive("header")

Matt Goodall twisted-web@twistedmatrix.com
Sun, 21 Mar 2004 23:46:05 +0000


On Sat, 2004-03-20 at 08:11, Mary Gardiner wrote:
> Hi,
> 
> I've been learned Nevow mainly by instinct, so this may be documented
> somewhere and I can't find it.
> 
> If I wanted to produce XML that looks something like:
> 
> <tag1>
>     <tag2/>
>     <tag3/>
>     <tag4/>
>     <tag4/>
>     ...
>     <tag4/>
> </tag1>
> 
> how would I do it?
> 
> I am using render = directive("sequence") for tag1, and pattern = "item"
> for tag4.
> 
> This works fine for:
> 
> <tag1>
>     <tag4/>
>     <tag4/>
>     ...
>     <tag4/>
> </tag1>
> 
> but I want to include those extra tags. I thought setting render =
> directive("heading") on tag2 and tag3 might work, but it gives the
> following error:
> 
>     File "/home/mary/src/Nevow/nevow/accessors.py", line 53, in child
>         return self.original[int(name)]
>     exceptions.ValueError: invalid literal for int(): header
> 
> after a long traceback.
> 
> The two attached files should demonstrate the problem: noheader.py
> works, header.py gives the error mentioned.
> 
> Is this a bug or am I simply going about this the wrong way?

Are you trying to include "static" HTML as a header for the sequence or
do you want the header to be generated using data that is only known at
run time?

- Matt

-- 
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt@pollenation.net

Any views expressed are my own and do not necessarily reflect
the views of my employer.