[Zope] more help with externs, please . . .

Kevin Dangoor kid@ans.net
Wed, 17 Feb 1999 13:01:14 -0500


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