[Twisted-Python] Best way to modify <meta> tags in Woven...

Mary Gardiner mary-twisted at puzzling.org
Thu Oct 16 02:03:50 MDT 2003


On Thu, Oct 16, 2003, Stuart Hungerford wrote:
> Hi all,
> 
> I have a Woven-based web application that needs to modify the
> <meta> tags of the generated HTML from the application (i.e.
> the attribute values of the meta tags).
> 
> What's the best way to approach this in Woven?   I'd guess
> I could find the <head> element in Woven then use the lmx DOM
> functions to insert a new <meta> element?
> 
> Any advice much appreciated.

Apologies if I'm misunderstanding the architecture, but can you simply
have a template that looks like this?

''''
<html>

<head>

<meta model="MetaModel" view="AttributeAdder/>

</head>
'''

etc etc...

And then the relevant Page subclass has a wmfactory_MetaModel method and
a wvfactory_AttributeAdder method which returns some kind of Widget.  In
the setUp method of the Widget, you can manipulate the node. This saves
you from having to search down from the head -- you *know* that the node
argument to the Widget's setUp method is the "meta" node.

Of course this requires that you know how to generate the meta tag's
attribute at the time of the generation of the HTML, and you said you
wanted to "modify the <meta> tags of the generated HTML" -- does this
mean you don't know what the <meta> tags will look like until *after*
the page has been generated?

-Mary




More information about the Twisted-Python mailing list