On Feb 17, 2011, at 9:01 AM, Andrew Evans wrote:
> hey is there anyway to say get the current site the user is on
> 
> for example: routes_onerror = [(r'*/*', r'/dojo/error/index')]
> 
> this returns all domains to dojo/error/index. Is it possible to do somehing 
> like this  /request.application/error/index/
> 
> any ideas
> 
> *cheers
> 
> 
> 

Use an explicit list of your applications

[
    ('dojo/*', '/dojo/error/index'),
    ('musico/*', '/musico/error/index'),
    ('admin/*', '/admin/default/error'), # I made that up...
    ('*/*', '/dojo/error/index'),
]

The */* entry will be used when the error happens before web2py figures out the 
application. For example, with http://domain.com/something.php, if 
'something.php' is interpreted as the app name, you'll get a 400 error before 
request.application is set, because '.' is not allowed in app names.

Of course, you could rewrite this in routes_in to avoid that particular case, 
perhaps sending *.php directly to dojo/default/index, and avoid the error 
handling altogether.

Reply via email to