[Zope] RE: How does a dtml-method of a ZClass refer to the ZClass instance?
Jean Lagarde
jean.lagarde@eer-rc.com
Thu, 28 Jun 2001 14:02:46 -0700
Of course, one obvious solution is to use a Python script instead, which is
what I have now done, but I am still curious to know if this is possible
with a dtml method.
Cheers,
Jean
> -----Original Message-----
> From: Jean Lagarde
> Sent: Thursday, June 28, 2001 11:10 AM
>
> Help!
>
> I think I still have a long way to go to fully grasp the
> namespace/acquisition/whereverelsevaluescomefrom structure of
> Zope (and I suppose I'll find all of it rather obvious once I 'get it').
>
> Simply put, I would like to access the objectValues (i.e. the
> contained objects) of a ZClass instance (based on ObjectManager)
> from a dtml-method of the ZClass, no matter what the calling path
> is, and I just can't figure it out.
>
> My specific problem is that I am calling the dtml-method of a
> ZClass instance from a dtml-document contained in a second
> instance of that same ZClass, and no matter what I've tried so
> far, the dtml-method always ends up using the objectValues in the
> second instance. I have verified that the ZClass dtml-method is
> called within the context of the instance I want, because if I
> insert <dtml-var aPropertyOfMyZClass> in the method, it spits out
> the correct value of the property for the instance. What I really
> need is to get a hold of the ZClass instance itself, let's call
> it 'self', so I can use 'self.objectValues()' inside of my
> dtml-method. It seems to me that if I can get to
> aPropertyOfMyZClass, I should be able to get to the instance that
> owns that property, but how?
>
> I know that 'aq_parent' and 'this' are not what I need. I have
> also tried 'superValues()', and 'getParentNode().objectValues()',
> just in case.
>
> Any suggestion would be appreciated. I have kept the description
> of my setup pretty simple here (there are a few intermediate
> calls between the dtml document and the dtml-method of my
> ZCLass); I can provide more details as required.