On Jun 2, 2012, at 5:55 PM, Ricardo Pedroso wrote:
> 
> On Sat, Jun 2, 2012 at 4:08 PM, Bruce Wade <[email protected]> wrote:
>> Yeah that fixed that one problem
>> 
>> I found IF there is a space in the file name it will not work, and if it
>> doesn't use ascii characters as LighDot said it wont work. Do you know which
>> part of web2py code handles this or if it is possible to make it work with
>> Chinese Characters?
>> 
> 
> It's in gluon/rewrite.py the following regex:
> 
> regex_static = re.compile(r'''
>     (^                              # static pages
>         /(?P<b> \w+)                # b=app
>         /static                     # /b/static
>         /(?P<x> (\w[\-\=\./]?)* )   # x=file   <--- HERE
>     $)
>     ''', re.X)
> 
> If you change the line marked with "HERE" to:
>         /(?P<x> (.*) )   # x=file
> 
> it should work. Be aware that could be some implications with this
> change, I'm not a regex expert.

FWIW, the parametric router lets you override the regex pattern that's used for 
path validation. The default pattern is:

        file_match = r'(\w+[-=./]?)+$',    # legal file (path) name



Reply via email to