[Tutor] Untainting CGI parameters

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

>>> type = re.search('\d+',a).group() or 'page'
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'NoneType' object has no attribute 'group'

> If the search does not succeed, the returned object has the value 
> None, which has no attribute group.

Ah yes! I forgot about the call to group(). I was just thinking if
we got a None match.
Ironic since it was me tagged the group call on in the first place!

try/except it needs to be then...

Alan G. 

More information about the Tutor mailing list