Your regular expression is not well formed.
form.regexp simply calls re.match and there is no difference between
form.Textbox and form.File in this context since in both cases
for.regexp.valid is called.

If you want it to work you should define all the charterers come
after .tar as optional
that is
exp = r".*((tar(\.(bz2|gz))|tgz)?)$"
instead of :
exp = r".*((tar\.(bz2|gz))|tgz)$"
see below a simple re match

>>> import re
>>> exp = r".*((tar\.(bz2|gz))|tgz)$"
>>> f = "/home/test.tar"
>>> re.match(exp, f)
>>> re.match(exp, f+".gz")
<_sre.SRE_Match object at 0xb7db3430>
>>> re.match(exp, f+".tgz")
<_sre.SRE_Match object at 0xb7db3480>
>>> re.match(exp, f+"fr")
>>> exp = r".*((tar(\.(bz2|gz))|tgz)?)$"
>>> re.match(exp, f+".tgz")
<_sre.SRE_Match object at 0xb7de9e90>
>>> re.match(exp, f+"fr")
<_sre.SRE_Match object at 0xb7de9ee8>
>>> re.match(exp, f)
<_sre.SRE_Match object at 0xb7de9e90>
>>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to