[Tutor] Untainting CGI parameters

Alan G alan.gauld at freenet.co.uk
Thu Aug 11 10:06:52 CEST 2005


> I will combine Kent's and your suggestion, because he included a 
> check for an AttributeError:
>

OK, as a slightly more perl-ish solution to the no Attribute problem
you could also do this:

try:
    type = re.search('\w+', parameters['type'].value).group() or 
'page'
except KeyError:
    type = 'page'

HTH

Alan G.




More information about the Tutor mailing list