What do you mean you "cannot define custom error page". if you put it at
the end of your routes.py file what happens? Are they ignored? Do you get
an error? I do not see you using routes_onerror in the example. Or is the
problem that routes on error cannot be declared in the routes.conf file?
On Monday, 29 April 2013 20:25:33 UTC-5, Nikolay wrote:
>
> Hi Massimo,
>
> I use this. Correct, once using autoroutes (name to routes.py) I cannot
> define custom error page no more. I of course get rid of un-needed stuffs))
>
> Please let me know of fix or new way for automatic routing.
>
> config = '''
> 127.0.0.1 /path
> example.com /path
> '''
> if not config.strip():
> try:
> config = open('routes.conf','r').read()
> except:
> config=''
>
> #Setup Default
>
> def auto_in(apps):
> routes = [
> ('/robots.txt','/path/static/robots.txt'),
> ('/favicon.ico','/path/static/favicon.ico'),
> ('/sitemap.txt','/path/static/sitemap.txt'),
> ('/admin$anything','/admin$anything'),
> ]
> for domain,path in [x.strip().split() for x in apps.split('\n') if
> x.strip() and not x.strip().startswith('#')]:
> if not path.startswith('/'): path = '/'+path
> if path.endswith('/'): path = path[:-1]
> app = path.split('/')[1]
> routes += [
> ('.*:https?://(.*\.)?%s:$method /' % domain,'%s' % path),
> ('.*:https?://(.*\.)?%s:$method /static/$anything' %
> domain,'/%s/static/$anything' % app),
> ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
> domain,'/%s/appadmin/$anything' % app),
> ('.*:https?://(.*\.)?%s:$method /$anything' %
> domain,'%s/$anything' % path),
> ]
> return routes
>
> def auto_out(apps):
> routes = []
> for domain,path in [x.strip().split() for x in apps.split('\n') if
> x.strip() and not x.strip().startswith('#')]:
> if not path.startswith('/'): path = '/'+path
> if path.endswith('/'): path = path[:-1]
> app = path.split('/')[1]
> routes += [
> ('/%s/static/$anything' % app,'/static/$anything'),
> ('/%s/appadmin/$anything' % app, '/appadmin/$anything'),
> ('%s/$anything' % path, '/$anything'),
> ]
> return routes
>
> routes_in = auto_in(config)
> routes_out = auto_out(config)
>
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.