[Twisted-web] nevow tags and class attribute
Matt Goodall
matt at pollenation.net
Mon Apr 12 04:31:41 MDT 2004
On Mon, 2004-04-12 at 02:05, Samuel Reynolds wrote:
> At 2004-04-10 03:34 PM -0500, you wrote:
> >Use a leading underscore to assign something to "class". Nevow will strip
> >that out for you:
> >
> >return T.p(_class=paraClass)[...]
>
> Argghhhhh! And all this time I've been doing
> tag = T.p()[...]
> tag.attributes['class']=paraClass
>
> I *hate* magical incantations.
> Otherwise, I rather like Nevow. :-)
But the whole of Nevow's stan is magical. It's an abomination! A hideous
abuse of Python's __getitem__ machinery! It's lovely :).
If you really want to avoid _class (_for is another) you can do:
attrs = {'class': paraClass}
tag = T.p(**attrs)[...]
or even:
tag = T.p(**{'class': paraClass})[...]
Cheers, Matt
--
__
/ \__ Matt Goodall, Pollenation Internet Ltd
\__/ \ w: http://www.pollenation.net
__/ \__/ e: matt at pollenation.net
/ \__/ \ t: +44 (0)113 2252500
\__/ \__/
/ \ Any views expressed are my own and do not necessarily
\__/ reflect the views of my employer.
More information about the Twisted-web
mailing list