David Wagle wrote:
Ok, figured it out. Thanks to everyone for the help basically (after playing around with it for a bit) I found that the following code:
def dwName(self,REQUEST=None): "return the AUTHENTICATED_USER string" if REQUEST is None and hasattr(self,'REQUEST'): REQUEST=self.REQEUEST return "%s" % REQUEST['AUTHENTICATED_USER']
works fine when called with teh following DTML:
<!--#var "dwName('self',_['REQUEST'])"-->
Now -- WHY it has to be this explicite I'm still unclear on. I understand that there's a difference between the dtml engine and the ORB, but what exactly is going on here is unclear.
Moreover, MOST of the people I talked with thought that the code should work if called from soemthing like:
<!--#var "dwName(REQUEST)"--> or even <!--#var dwName-->
However, to get it to work requires the dtml I provided earlier.
I ran into something similar yesterday. *doublechecks* Yes. It's weird, I don't know why, but somehow 'REQUEST=None' in the parameter list of the external method makes a difference. Let's say I have these external methods: def reqtest0(self, REQUEST): if REQUEST: return "Got REQUEST" else: return "No REQUEST" def reqtest1(self, REQUEST=None): if REQUEST: return "Got REQUEST" else: return "No REQUEST" One'd think they'd do the same, right? Somehow, they don't. In DTML: <!--#var "reqtest0(REQUEST)"--> Gives me 'Got REQUEST' While: <!--#var "reqtest1(REQUEST")--> Gives "No REQUEST" Finally, imitating your trick (why the quoted 'self'?): <!--#var "reqtest1('self', _['REQUEST'])"--> Gives "Got REQUEST". (same result for reqtest0) Bizarre. Anyone know why? Some thorough explanation would be useful. I'm feeling as if I've just entered the Perl^H^H^H^HTwilight Zone. :) Regards, Martijn