[Twisted-Python] twisted newbie question about woven and model
Philippe Lafoucrière
lafou at wanadoo.fr
Wed Jun 4 01:43:22 MDT 2003
Hum
I get an exception when I use object/title
exceptions.Exception: Node had a model=object/title attribute, but the
submodel was not found in [<twisted.web.woven.model.Wrapper instance at
0x843be3c: wrapped data: <ObjectManager instance at 0x8a24b5c>>].
(with model = object)
On Wed, 2003-06-04 at 09:33, Donovan Preston wrote:
> 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
> > 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="object" view="None">
> > <span model="title" view="Text" />
> > ...
> > </span>
> >
> > 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!
>
> Donovan
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
--
Philippe Lafoucrière <lafou at wanadoo.fr>
InFuzzion
More information about the Twisted-Python
mailing list