On Jun 2, 2012, at 6:32 PM, Ricardo Pedroso wrote:
>
>> 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
>
> I didn't now about this one, thanks Jonathan.
> In fact the router mechanism is still a little bit obscure to me.
>
> I notice now that file_match is documented in router.example.py.
> So I copy router.example.py to routes.py and defined the routers dict like
> this:
>
> routers = dict(
> # base router
> BASE = dict(
> default_application = 'welcome',
> file_match = r'(.*)$', # legal file (path) name
> ),
> )
>
> and it worked woth chinese chars in a filename.
> Is this the correct place to use file_match?
It'd be better to restrict the change to the app in question:
routers = dict(
# base router
BASE = dict(
default_application = 'welcome',
),
welcome = dict(
file_match = r'(.*)$', # legal file (path) name
),
)
...and you might want to be a little more restrictive than .* if you can. But
yeah, that's the idea.