[Twisted-Python] twisted newbie question about woven and model

Donovan Preston twisted-python@twistedmatrix.com
Wed, 4 Jun 2003 00:33:20 -0700


On Wednesday, June 4, 2003, at 12:25 AM, Philippe Lafoucri=E8re wrote:

> hi all
>
> I'am trying to display some information via a .rpy script. My model is=20=

> a
> complex object with several properties such as :
>
> object.title
> object.name
> object.creationDate
> ...
>
> The only way I found to display title & name is
>
> <span model=3D"object" view=3D"None">
> 	<span model=3D"title" view=3D"Text" />
> 	...
> </span>
>
> Is it possible to access directly object.title ?
> model=3D"object.title" doesn't work of course.

Certainly. Woven uses / rather than . as the submodel name separator.=20
So simply do this:

<span model=3D"object/title" view=3D"Text" />

/ is used rather than . because / can indicate any method of accessing=20=

a conceptual child object, whether it occurs by attribute access,=20
dictionary or list lookup, or method call; it's up to the IModel=20
adapter to decide how to access children. I believe this is covered in=20=

the "Model in Depth" section of the documentation.

Hope that helps!

Donovan