[Twisted-Python] The problem with Twisted...

Donovan Preston dp at twistedmatrix.com
Thu Jun 5 13:15:12 MDT 2003


On Thursday, June 5, 2003, at 02:28 AM, Philippe Lafoucrière wrote:

> I think I can put :

*snip*

> in the wvfactory_foo !?

You can, but you should not. Factory methods have one purpose and one 
purpose only: To return a new object.

Update methods are special because they allow you to write the 
equivalent of a new Widget class with an overridden setUp method, 
without writing a new class.

Why does it matter so much where the DOM manipulation occurs? Because 
one of the design goals of woven was to allow a portion of an 
already-rendered page to be re-rendered. The way this is currently 
implemented is by keeping the Widget instances produced by the 
wvfactory_ methods in memory so that the generate (and thus setUp) 
methods may be executed again multiple times.

How is wvupdate_ different? When woven notices a wvupdate_ method, it 
creates a generic Widget instance and places a function pointer to the 
wvupdate_ method on this instance. In this way, the wvupdate_ method 
can be executed multiple times in order to re-render that portion of 
the page.

I know it is confusing, and I hope to remove some of this complexity in 
a future woven version.

dp





More information about the Twisted-Python mailing list