Nevow: directive("header")

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? -Mary

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.

On Sun, Mar 21, 2004, Matt Goodall wrote:
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?
The latter. My particular use-case is dynamically generated RSS feeds, where the channel tag is the parent of the sequence, there are a bunch of header tags (title of the feed, link to the feed and so on) and the item tags, immediate children of the channel tag, are the sequence data. The RSS pages are children of dynamically generated parents. The values of the fields are known at request time, but are not static in the sense you mean. If this was HTML, I could perhaps wrap the sequence in a span or div (<parent><head_child/><head_child/><span><sequence_item/><sequence_item/></span></parent>) but the RSS spec doesn't have any convienient wrapper tags of that nature. -Mary
participants (2)
-
Mary Gardiner
-
Matt Goodall