[Twisted-Python] twisted newbie question about woven and model
dp at twistedmatrix.com
Wed Jun 4 03:33:20 EDT 2003
On Wednesday, June 4, 2003, at 12:25 AM, Philippe Lafoucrière wrote:
> hi all
> I'am trying to display some information via a .rpy script. My model is
> complex object with several properties such as :
> The only way I found to display title & name is
> <span model="object" view="None">
> <span model="title" view="Text" />
> Is it possible to access directly object.title ?
> model="object.title" doesn't work of course.
Certainly. Woven uses / rather than . as the submodel name separator.
So simply do this:
<span model="object/title" view="Text" />
/ is used rather than . because / can indicate any method of accessing
a conceptual child object, whether it occurs by attribute access,
dictionary or list lookup, or method call; it's up to the IModel
adapter to decide how to access children. I believe this is covered in
the "Model in Depth" section of the documentation.
Hope that helps!
More information about the Twisted-Python