[Zope] setting the client namespace for a DTML Method
Guido A.J. Stevens
gyst@nfg.nl
18 Mar 2000 09:37:58 +0100
[ This message never made it to the list somehow, reposting now... ]
X-From-Line: nobody Thu Mar 16 12:09:02 2000
X-Face: QmL':f1ZwaRtW?E^9)c*r4r[',ky+1<e`?s,[rt'*s@6awNjJQ?,s8ArMu7TD"pJW(KI!I%
BY-c##<^KlGL@'#YWptcmBOP0\1\y/$(OO*3-V~>8?<2\;7#Dwh,9ut}(dpQCo}ydCZZ~,?
X-Attribution: gyst
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
Message-ID: <87n1nz894w.fsf@wiz.wiz>
X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald"
Lines: 56
Xref: wiz.wiz sent-mail:4525
X-Gnus-Article-Number: 4525 Thu Mar 16 12:09:02 2000
When Zen borders on Kamikaze.....
DTML Document --> product method --> DTML method
I've been banging my head against this for 4 days in a row now. I want
to call a DTML method, via a product method, from a DTML document, but
I don't succeed in setting the client namespace for the DTML method to
the original DTML Document's namespace.
I'd appreciate any help!
I have a DTML document. It has a valid aq_parent. From this DTML document,
I'm calling a product method, passing the DTML documents's aq_parent as
an argument:
<dtml-var "NFGnavCore.aqqy(aq_parent)">
This method has access to the aq_parent object all right, tested
OK. Next, the DTML method is called from the product python method and
the original aq_parent object is given as the new acquisition context:
def aqqy(self, context=None):
""" some test method"""
retval= "Hi! I'm the aqqy method, called with context.id <b>%s</b>" % context.id
return retval + self.aqqy_helper(client=context)
The DTML method 'aqqy_helper' is called all right, but has no access
to the context object passed in. Any attempt to access objects that
should be in the acquired namespace, for example:
My aq_parent id= <dtml-var "aq_parent.id">
results in an error message:
You are not authorized to access aq_parent.
Which, if I'm not mistaken, is caused by the validate routine called
from OFS/DTMLMethod.py as documented in 'oldvalidate()':
if inst is parent:
raise 'Unauthorized', (
'You are not authorized to access <em>%s</em>.' % name)
So what am I doing wrong, and what is the right way to call DTML
methods from product methods?
:*CU#
--
*** Guido A.J. Stevens *** mailto:gyst@nfg.nl ***
*** Net Facilities Group *** tel:+31.43.3618933 ***
*** http://www.nfg.nl *** fax:+31.43.3560502 ***
By 2003, most industrial countries wil log and analyze the movements
of every citizen.
[Pearson, ISBN 0-02-862089-5, p.62]