Paul Everitt wrote:
Martijn Faassen wrote:
Martijn Faassen wrote:
Stefan Franke wrote:
[description of weird behavior/bug with default parameters in external methods]
I believe your questions are: 1. Why is it tricky to call External Methods with variable expressions from DTML? 2. Why do some REQUESTs have AUTHENTICATED_USERs and some don't? The answer to question 1 is that External Methods are slightly weird methods which when called from variable expressions in DTML need to explicitly be passed the self argument if they define one. For example: def myMethod(self, foo, bar): "blah blah" ... will not work correctly is called like so: <!--#var "myMethod('foo','bar')"--> because this assigns 'foo' to self and 'bar' to foo and nothing to 'bar'. Instead you should do this: <!--#var "myMethod(foo='foo',bar='bar')"--> Or if you really want to pass self, you can choose a Zope object to pass (such as the parent Folder in the case of DTML methods or 'this()' in the case of other Zope objects.) For example here's one way to explicitly pass the self argument: <!--#var "myMethod(this(),'foo','bar')"--> The answer to question 2 is that AUTHENTICATED_USER object is only present in the REQUEST object when the ORB puts it there. The ORB only puts it there when it has to perform authentication to publish the requested object. So if you are publishing a Document that is publicly viewable, the AUTHENTICATED_USER will not be set. As for the identity of the REQUEST as passed by the ORB when publishing a method, versus the acquired request (self.REQUEST) versus the REQUEST available in DTML, they should all be the same. I hope this clears things up a bit. -Amos