one correction, the \\g's are actually \g

On Fri, Sep 28, 2018 at 12:20 PM Bryan Chance <bhcha...@gmail.com> wrote:

> I'm working to switch my web2py application to Python 3. However, I now
> get errors when loading due to my routes.py:
>
>   File "/usr/lib/python3.6/sre_parse.py", line 401, in _escape
>     raise source.error("bad escape %s" % escape, len(escape))
> sre_constants.error: bad escape \g at position 35
>
>
> My routes.py is posted below, and the idea behind it is that
> myurl.com/client_name gets routed to
> myurl.com/myappname?client=client_name:
>
> routes_app = ((r'/(?P<app>admin|app)\b.*', r'\\g<app>'),
>               (
>               r'/(?P<app>app_to_be_excluded)\b.*',
>               r'\g<app>')
>               )
>
> routes_in = [
>     # make sure you do not break admin
>     ('/admin', '/admin'),
>     ('/admin/$anything', '/admin/$anything'),
>     # make sure you do not break appadmin
>     ('/$app/appadmin', '/$app/appadmin'),
>     ('/$app/appadmin/$anything', '/$app/appadmin/$anything'),
>     ('/static/$anything', '/myappname/static/$anything'),
>     ('/$domain(?P<rest>.*)$', '/myappname\\g<rest>?client=$domain'),
> ]
>
> routes_out = [(a, b) for (b, a) in routes_in]
>
> Does anyone have any ideas how I can update this regex to work?
>
> --
> 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.
>

-- 
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