more help with externs, please . . .
Ok, I thought I had a handle on this after Amos' message yesterday . . .but I clearly don't have a clue as to what is going on. I have the following external method: def dwtest(self,REQUEST=None): "find out what the hell is going on with REQUEST headers" if REQUEST is None and hasattr(self,'REQUEST'): REQUEST=self.REQEUEST return "REQUEST is None and hasattr(self,'REQUEST')" elif REQUEST is None and not hasattr(self,'REQUEST'): return "REQUEST is None. Self does not have attr REQUEST" elif REQUEST is not None and hasattr(self,'REQUEST'): return "REQUEST is not None. self has attr REQUEST" elif REQUEST is not None and not hasattr(self,'REQUEST'): return "REQUEST is not none. self does not have attr" If I call it with the URL, I get the expected: REQUEST is not None. self has attr REQUEST If I call it with the DTML <!--#var "dwtest('REQUEST')"--> I get: REQUEST is None. Self does not have attr REQUEST" ??? I am missing somethign really fundamental here, and I don't know what it is. Help please. ... daw --------------------------------------------- A computer without Microsoft products is like a dog without bricks chained to its head ---------------------------------------------
On 17 Feb 99, at 11:44, David Wagle wrote: Try this: <!--#var "dwtest()"--> I've made similar changes to my external functions and indeed, self.REQUEST works. However self.RESPONSE doesn't seem to work, so I still have to pass that explicitely. Anyone know why?
Ok, I thought I had a handle on this after Amos' message yesterday . . .but I clearly don't have a clue as to what is going on.
I have the following external method:
def dwtest(self,REQUEST=None): "find out what the hell is going on with REQUEST headers" if REQUEST is None and hasattr(self,'REQUEST'): REQUEST=self.REQEUEST return "REQUEST is None and hasattr(self,'REQUEST')" elif REQUEST is None and not hasattr(self,'REQUEST'): return "REQUEST is None. Self does not have attr REQUEST" elif REQUEST is not None and hasattr(self,'REQUEST'): return "REQUEST is not None. self has attr REQUEST" elif REQUEST is not None and not hasattr(self,'REQUEST'): return "REQUEST is not none. self does not have attr"
If I call it with the URL, I get the expected:
REQUEST is not None. self has attr REQUEST
If I call it with the DTML <!--#var "dwtest('REQUEST')"--> I get:
REQUEST is None. Self does not have attr REQUEST"
???
I am missing somethign really fundamental here, and I don't know what it is.
Help please. ...
daw
--------------------------------------------- A computer without Microsoft products is like a dog without bricks chained to its head ---------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com ICQ: 14856937
On Wed, Feb 17, 1999 at 11:44:54AM -0600, David Wagle wrote: ,----- | | Ok, I thought I had a handle on this after Amos' message | yesterday . . .but I clearly don't have a clue as to what | is going on. | | I have the following external method: | | def dwtest(self,REQUEST=None): | "find out what the hell is going on with REQUEST headers" | if REQUEST is None and hasattr(self,'REQUEST'): | REQUEST=self.REQEUEST | return "REQUEST is None and hasattr(self,'REQUEST')" | elif REQUEST is None and not hasattr(self,'REQUEST'): | return "REQUEST is None. Self does not have attr REQUEST" | elif REQUEST is not None and hasattr(self,'REQUEST'): | return "REQUEST is not None. self has attr REQUEST" | elif REQUEST is not None and not hasattr(self,'REQUEST'): | return "REQUEST is not none. self does not have attr" | | If I call it with the URL, I get the expected: | | REQUEST is not None. self has attr REQUEST | | If I call it with the DTML <!--#var "dwtest('REQUEST')"--> I get: | | REQUEST is None. Self does not have attr REQUEST" | | ??? | | I am missing somethign really fundamental here, and I don't know | what it is. Ahh... it's just a small syntax issue. When you call dwtest('REQUEST'), you are passing in the string "REQUEST". dwtest(REQUEST) should pass in the variable. Also, it sounds like DTML does not pass in anything by default. If you really want "self" to be defined, your DTML should probably be dwtest(self, REQUEST) Kevin | | Help please. ... | | daw | | | | --------------------------------------------- | A computer without Microsoft products is like | a dog without bricks chained to its head | --------------------------------------------- | | _______________________________________________ | Zope maillist - Zope@zope.org | http://www.zope.org/mailman/listinfo/zope `----- -- Kevin Dangoor UUnet Technologies kid@ans.net / 734-214-7349
participants (3)
-
Brad Clements -
David Wagle -
Kevin Dangoor