[Zope] Keys in Request
    robert rottermann 
    robert at redcor.ch
       
    Wed Mar  3 05:19:20 EST 2004
    
    
  
Philip Kilner wrote:
> Hi List,
>
> Can't figure this out - need help!
>
> In a Script (Python), I'm testing for the presence (or more precisely 
> the absence) of a key in the request, like so: -
>
> request=context.REQUEST
>
> if not request.has_key('the_key'):
>
> The problem is that the test always fails (e.g. it acts as though the 
> key is absent, even when it is not). If I modify the test to check for 
> a form filed, it works fine.
>
> What am I doing wrong?
>
Request is not a dictionary, it just behaves simmilar.
You could use sommething like:
the_key = request.get('the_key', None):
if the_key ...
robert
    
    
More information about the Zope
mailing list