[Twisted-Python] Woven Model extreme pain

Syver Enstad syver at inout.no
Fri Oct 3 04:32:00 EDT 2003

James Y Knight <foom at fuhm.net> writes:

> Returning a Deferred from submodelFactory doesn't seem to work
> *either*, if you then want to get a submodel of that.
> E.g simplified:
> 	def result1(self, d):
> 		d.callback((1,3,4,5))
> 	def wmfactory_foo(self, request):
> 		d = defer.Deferred()
> 		reactor.callLater(1000000, self.result1, d)
> 		return d
> If you then ask for a model="foo/0", twisted claims there is no such
> model, immediately. so it's not even trying to deal with the
> deferred. arrrrgh.
> Is none of this tested? I can't believe I'm only person who wants to
> do this?
> This is really making me want to give up. It seems nice but nothing
> works!

I've also been down this road James. You can't tunnel through
deferreds in the submodel path, and you have to specify a view for the
deferred system to work.


All examples are just written from memory and are completely untested.

<span model="foo/0"></span> 
won't work because tunneling through the deferred is not supported

<span model="foo">
  <span model="0" view="Text"></span>
won't work because the default view, DefaultWidget doesn't support deferreds

<span model="foo" view="Widget">
  <span model="0" view="Text"></span>

should work because the Widget handles the deferred model and
postpones processing of child nodes until the deferred result is

All views that are derived from Widget (and doesn't override the
deferred handling in generate) should work:

<span model="foo" view="Text"></span>


<span model="foo" view="List">
  <span pattern="listItem"></span>

More information about the Twisted-Python mailing list