Dieter Maurer wrote:
ra@burningman.com writes:
Dieter Maurer wrote:
Ra writes:
is there any way to gain access to an instance of a zclass from a dtml method that is within that zclass? When called from ZPublisher (i.e. the Web), it should run in the context of this Z instance, i.e. the instance is at the top of the DTML namespace. You can (under these conditions) use its "this" method to get the instance itself.
Alas, "this" isn't working; I get "global name 'this' is not defined". Looks like the DTML Method is not called correctly (apparently, nothing on its namespace has an acquisition context).
Yep, this was it.
How is th DTML Method activated? Via ZPublisher? Explicitely?
I've got a dtml-method called "member_detail_html" which calls the dtml-method "detail_html" within the user object. "member_detail_html" originally contained the following: ------------- <dtml-var header> <dtml-if membername> <dtml-var "acl_users.getItem(membername).detail_html()"> <dtml-else> <dtml-var "_.SecurityGetUser().detail_html()"> </dtml-if> <dtml-var footer> -------------- I changed "member_detail_html" like so: -------------- <dtml-var header> <dtml-if membername> <dtml-let userobj="acl_users.getItem(membername)"> <dtml-var "userobj.detail_html(userobj, REQUEST)"> <dtml-let> <dtml-else> <dtml-var "_.SecurityGetUser().detail_html(_.SecurityGetUser(), REQUEST)"> </dtml-if> <dtml-var footer> --------------- and it is now working. I'm not 100% certain I've chosen the right parameters to pass in, though... my best guess is that the first parameter is supposed to be the "this()" object (i.e. the top of the called method's namespace stack) and the second parameter should be the REQUEST, if needed. Is this correct? Thanks for your help! -r