[Twisted-Python] Re: Woven: can't get view notification to work

Donovan Preston dp at twistedmatrix.com
Wed Dec 10 13:25:43 MST 2003


On Dec 10, 2003, at 2:00 PM, Gavrie Philipson wrote:

> On Wed, 10 Dec 2003 12:23:56 -0500, Donovan Preston wrote:
>
>> On Dec 10, 2003, at 5:20 AM, Gavrie Philipson wrote:
>>
>>>         lmx(node).p().text(str(mydict))
>>
>> Change this to lmx(self) and it works. It's the widget that knows the
>> correct place in the current DOM to make changes, not the template 
>> node
>> that was passed in (node).
>
> Ah, now I see... you wouldn't believe how much I agonized over this... 
> thanks.

Good, I'm glad that fixed it for you.

> Incidentally, since you keep mentioning Nevow, I did have some 
> thoughts on
> using it instead of Woven.

As I mentioned before, the parts of woven which are not yet implemented 
in Nevow are the LivePage and partial-page-rerendering stuff. You, by 
using notify, are using the partial-page-rerendering stuff. I'd be 
interested in knowing what you want to use it for, and how I can 
accommodate this use case and my use cases without being too 
heavyweight and cumbersome.

> However, I am using template files to generate forms instead of 
> generating
> them from the code (I need precise layour control). It seems that Nevow
> doesn't yet fully handle rendering of template files. Is this correct? 
> Are
> any changes to this expected soon?

Hmm -- I'm not sure where people get the impression that disk templates 
aren't supported. nevow.renderers.HTMLRenderer is the Resource subclass 
to use, and you can use it like this:

class Foo(HTMLRenderer):
	def data_bar(self, context, data):
		return "bar!"

	def render_baz(self, context, data):
		return "Baz (%s)" % data


Then, your HTML template would have model= and view= directives in it 
(eventually, these will be replaced by nevow:data and nevow:render 
directives, but I implemented model= and view= directives to allow use 
of woven templates)

<html>
	<body>
		<div model="bar" view="baz" />
	</body>
</html>

dp





More information about the Twisted-Python mailing list