[Zope] testing for "REQUEST is not None"

Oliver Bleutgen myzope@gmx.net
Thu, 07 Nov 2002 17:11:03 +0100


Willem Broekema wrote:

> REQUEST is an instance of the class Request, which  is an alias for 
> HTTPRequest, which is derived from BaseRequest, which has a method 
> __len__ that returns the constant 1, which is 'true', so REQUESTS are 
> *always* 'true'.
> 

;-)

Well I guess you just proved Jens true, who wrote in this thread (read 
with emphasis on _explicit_):

 >Saying "if REQUEST is not None" is a much more explicit way of saying 
 >"this condition fails because REQUEST really was never passed in". 
 >since "None" is the default argument for REQUEST you know for a fact 
 >that REQUEST was never passed into the function.

cheers,
oliver