[Zope-dev] wrapping unexistent objects

Casey Duncan casey@zope.com
Tue, 3 Dec 2002 13:20:41 -0500


Can you just use acquisition?

On Tuesday 03 December 2002 01:11 pm, Maurizio Boriani wrote:
> >>>>> "Casey" =3D=3D Casey Duncan <casey@zope.com> writes:
>=20
>     Casey> Its easy to create an infinite loop. To avoid these, do
>     Casey> attribute lookups from the instance __dict__ rather than
>     Casey> directly from self:
>=20
>     Casey> IOW, don't do:
>=20
>     Casey> foo =3D self.foo
>=20
>     Casey> or getattr(self, 'foo')
>=20
>     Casey> (This can trigger another __getattr__ call)
>=20
>     Casey> Instead do:
>=20
>     Casey> foo =3D self.__dict__['foo']
>=20
> in my case foo is a method not a properties
>=20
>     Casey> (This won't cause another getattr call)
>=20
>     Casey> As for examples, there is a complex one in the CMF
>     Casey> Skinnable module and a simpler one in the Document module
>     Casey> of my DocumentLibrary product.
>=20
> I tried this too but zope return an error ('Type Error, unsubscriptable=
=20
object').
>=20
> Exactly this is my case:
>=20
> I've a class called, for example, pippo. This cotain another class call=
ed=20
pluto.
>=20
> So wath I'd like to do is:
>     <dtml-with pippo>
>       <dtml-with pluto>
>         <dtml-var expr=3D"ciccio('parameter')">
>       </dtml-with>
>     </dtml-with>
>=20
> the expr or method ciccio doesn't exist in pluto but I'd like to pass t=
o a=20
defined method the expr and its parameters.
>=20
> A big thanks anymore for your help
>=20
> bye,
> baux=20
>=20
>=20