Jeppe Walther wrote:
> self.RAPid = request.params['RAPid']
>
> it seems an exception is raised if request.params cant findt the
> variable defined.
>
> Is there some other way to get URL variabels
> or to change the behavior of request.params.
You could use the get() method from params, which acts as a standard
python dict:
request.params.get('RAPid', False)
this is equivalent to "request.params['RAPid']", except if 'RAPid'
doesn't exist, it defaults to the value you've passed as second
position. That second arg could be anything you want.
Alternativly, you could use the if statment to test if 'RAPid' exists in
your dict:
if 'RAPid' in request.params:
... do something useful ...
documentation for python dicts:
http://docs.python.org/lib/typesmapping.html
check out the table for all the possibilities with dicts.
Regards,
--
Alexandre CONRAD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---