Massimo
This is because web2py does no allow spaces or other special
characters that need escaping in the URL.
Massimo
On May 7, 2008, at 3:32 PM, Chris Leonello wrote:
Massimo
Massimo
1) Add ^ at the beginning of the regular expression.
2) Print the string as passed to the match function.
This may be related to the regex "runaway problem"...
Massimo
I still cannot reproduce the error with web2py. I am using leopard.
Massimo
>>>>>>>>>>>> (/?\.?[\w\-\.]+)*/?$)|(?:^(\w+)/static(/\.?[\w\-\.]+)*/?
>>>>>>>>>>>> $)')
>>>>>>>>>>>> path='myapp/appadmin/download/file400404.doc/
>>>>>>>>>>>> abig_presentation
regex_url=re.compile('(?:^$)|(?:^\w+/?$)|(?:^\w+/\w+/?$)|(?:^(\w+/)
{2}\w+/?$)|(?:^(\w+/){2}\w+(/[\w\-]+(\.[\w\-]+)*)+$)|(?:^(\w+)/static(/
[\w\-]+(\.[\w\-]+)*)+$)')
I think this should fix the runaway problem caused by ((...)*)*
Massimo
The problem is that in expressions like
((...)*)*$
the more nested expression can match to empty and the python engine
(on some systems) is stupid enough to try whether an infinite
sequence of empty strings adds up to the expression to be matched. I
still do not see why the regex_url was falling in this trap but the
new one is more explicit and therefore I am more confident this does
not happen.
Massimo
>>>>>>>>>>> +(/?\.?[\w\-\.]+)*/?$)|(?:^(\w+)/static(/\.?[\w\-\.]+)*/?
>>>>>>>>>>> $)')
>>>>>>>>>>> path='myapp/appadmin/download/file400404.doc/
>>>>>>>>>>> abig_presentation
>>>>>>>>>>> 082005.doc'
>>>>>>>>>>> regex_url.match(path)
>>
Massimo