Hi there.

Routes is an area in Web2py I never really understood. :-(

I need your help.

I have the following routes.py in web2py.dir:

```
# web2py/routes.py
# -*- coding: utf-8 -*-

logging = 'debug'

default_application = 'myapp'

routes_app = ((r'/(?P<app>welcome|admin)\b.*', r'\g<app>'),
              (r'(.*)', r'myapp'),
              (r'/?(.*)', r'myapp'))
```

As you can see, I delegate urls for `myapp` to `myapp/routes.py` below:

```
# web2py/applications/myapp/routes.py
# -*- coding: utf-8 -*-

app = '/myapp'

routes_in = (
    ('/$c/$f', app + '/$c/$f'),
    ('/$c/$f/$anything', app + '/$c/$f/$anything'),
)

routes_out = [(to, from_) for (from_, to) in routes_in]
```

This structure allows me to have the url `
http://localhost:8000/default/index` <http://localhost:8000/default/index>
correctly routed. But it fails with I have an URL with extension: `
http://localhost:8000/default/index.html`
<http://localhost:8000/default/index.html>

Every URL with the extension fails.

BTW, I found this problem with $name notation when trying to load
components from a view with `LOAD(c="default", f="mycomponent.load",
ajax=True)`.

Then, now I have my routes.py with regular expressions working like a charm:

```
app = '/myapp'

routes_in = (
    ('/(?P<any>.*)', app + '/\g<any>'),
)

routes_out = (
    (app + '/(?P<any>.*)', '/\g<any>'),
)
```

What am I doing wrong with $name notation? Or it cannot handle extensions?
Or it is a bug?

--
Vinicius Assef.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to