Hi, I would like to untaint all parameters with which my CGI script is called. Example:
if parameters.has_key('type'): match = re.search('\w+', parameters['type'].value) type = match.group() else: type = 'page' In Perl, I used the ternary operator to write it like this: my $type = ($parameters{type} && ($parameters{type} =~ /^(\w+)$/)) ? $1 : 'page'; While this is not the most beautiful code to look at, I have a weakness for compact programs - so can I shorten the Python equivalent somehow? Thanks, Jan -- A good programmer is someone who looks both ways before crossing a one-way street. - Doug Linder _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor