[Twisted-web] data="../foo", or, how to prevent adding IData to centxt
Christopher Armstrong
twisted-web@twistedmatrix.com
Thu, 11 Dec 2003 06:58:35 -0500
I have a renderer:
def render_select(self, ctx, data):
try:
return ctx.keyed(data)
except context.NodeNotFound:
return ctx.keyed('else')
Which works nicely for things like:
<div nevow:data="usertype" nevow:render="select">
<span nevow:key="Writer">
<a href="edit">Edit this page</a>
</span>
<span nevow:key="else">HI</span>
</div>
However, I want to use data within those keyed nodes:
<div nevow:data="usertype" nevow:render="select">
<span nevow:key="Writer">
<form nevow:data="addPageForm" nevow:render="string"
action="addPage" />
<a href="edit">Edit this page</a>
</span>
<span nevow:key="else">HI</span>
</div>
This is causing nevow to try to do IContainer(directive('usertype')) so
it can get the 'addPageForm' child. addPageForm isn't a child of
usertype, though, so the most obvious thing to me (coming from a Woven)
background would be to use "../addPageForm" instead of "addPageForm" --
but nevow doesn't support that.
OTOH, I didn't need this with my old Woven implementation -- my 'select'
widget used to be implemented with patterns, and for whatever reason it
didn't try to look up inner models on the model used for doing the
select. I think I would like select to keep those semantics. Is there
anything I can do in render_select to prevent usertype from being placed
on the context as IData?
--
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
---------+ http://radix.twistedmatrix.com/