On Feb 27, 2011, at 10:17 PM, Kimmo wrote:
> 
> Hey thanks! It worked. I used to have $anything earlier. Dunno why I
> changed it to any.

It's not too well documented, but $anything translates to .*, and $any (or 
anything but $anything) translates to \w+. In particular, $any won't match a 
slash, only the content between slashes.

Add to that the fact that the pattern being matched by routes_out is always *at 
least* /a/c/f, and you'll see that /a/$any can never match anything. It 
translates to ^/a/\w+$, which can't match any version of /a/c/f.

So: the shortcuts are useful, but it's necessary to understand what they really 
mean. I lean toward spelling out the regular expression instead. Or using the 
new routers syntax, when it does the job for you.


> 
> Hmm. I guess I can do this kind of deployment if there's no one to
> tell me otherwise.
> This is good cause I don't want people going fiddling around with
> httpd.conf and restarting the server all the time, when they make
> mistakes with routing or want to setup a new app.
> 
> Kimmo
> 
> On Feb 24, 5:27 pm, Jonathan Lundell <[email protected]> wrote:
>> On Feb 24, 2011, at 12:30 AM, Kimmo wrote:
>> 
>> 
>> 
>>> So far I've only found one minor problem with this.
>> 
>>> In my example above, the links to other apps in the admin app wont
>>> work.
>>> For example clicking the app2 should redirect towww.myhost.com/subdir/app2,
>>> but it redirects towww.myhost.com/app2and results to Not Found.
>>> Other than that, all editing works fine.
>> 
>>> I tried to edit routes.py for admin like this, but it didn't have any
>>> effect on the link.
>>> routes_out = (('/app2/$any', '/subdir/app2/$any'),)
>> 
>> Use $anything instead of $any.
>> 
>> (and remember to restart web2py after the change)


Reply via email to