[web2py] Re: problems with hyphens in URL using routes.py

2018-11-01 Thread Dave S


On Thursday, November 1, 2018 at 6:03:56 AM UTC-7, Thomas Klopf wrote:
>
> Hello,
>  Please can someone help with a routing problem? I'm using pattern-based 
> routing (config below), mainly to map for example: 
>
> "/servers/server-123.json" to "/ids/servers/view.json?NAME=server-123"
>
> using routes.py entry:
>
>("/servers/$hostname.json","/ids/servers/view.json?NAME=$hostname")
>
>
> It works fine with "NAME=server" but if I have "NAME=server-123" 
> (/servers/servers-123.json) , I get an "invalid request" error. It looks 
> this is due to a restriction on having hyphens in application names and/or 
> issues parsing with hyphens in the name.
>
> Please can anyone suggest an alternative configuration, to allow hyphens 
> in the URL parameters?
>
> Thank you!
>

Perhaps escaping it, as *%#45;*  or ** or **  or maybe 
**.

/dps



>
> *web2py/routes.py*
>
> # -*- coding: utf-8 -*-
> # default_application, default_controller, default_function
> # are used when the respective element is missing from the
> # (possibly rewritten) incoming URL
> #
>
>
> # default_application, default_controller, default_function
> # are used when the respective element is missing from the
> # (possibly rewritten) incoming URL
> #
> default_application = 'ids'# ordinarily set in base routes.py
> default_controller = 'default'  # ordinarily set in app-specific routes.py
> default_function = 'index'  # ordinarily set in app-specific routes.py
>
> # routes_app is a tuple of tuples.  The first item in each is a regexp 
> that will
> # be used to match the incoming request URL. The second item in the tuple 
> is
> # an applicationname.  This mechanism allows you to specify the use of an
> # app-specific routes.py. This entry is meaningful only in the base 
> routes.py.
> #
> # Example: support welcome, admin, app and myapp, with myapp the default:
>
>
> routes_app = ((r'/(?Pwelcome|admin|ids)\b.*', r'\g'),
>   (r'(.*)', r'ids'),
>   (r'/?(.*)', r'ids'))
>
>
>
> *web2py/applications/ids/routes.py*
> # -*- coding: utf-8 -*-
> # default_application, default_controller, default_function
> # are used when the respective element is missing from the
> # (possibly rewritten) incoming URL
> #
>
> default_application = 'ids'# ordinarily set in base routes.py
> # default_controller = 'default'  # ordinarily set in app-specific 
> routes.py
> # default_function = 'index'  # ordinarily set in app-specific 
> routes.py
> # routes_app is a tuple of tuples.  The first item in each is a regexp 
> that will
> # be used to match the incoming request URL. The second item in the tuple 
> is
> # an applicationname.  This mechanism allows you to specify the use of an
> # app-specific routes.py. This entry is meaningful only in the base 
> routes.py.
> #
> # Example: support welcome, admin, app and myapp, with myapp the default:
> #
> #
> # routes_app = ((r'/(?Padmin|gio_sds)', r'\g'),
> #   (r'(.*)', r'gio_sds'),
> #   (r'/?(.*)', r'gio_sds'))
>
>
> routes_in = (
>   ('/admin/$anything', '/admin/$anything'),
># ('/default/$anything', '/default/$anything'),
>  ('/default/user/login.json', '/ids/default/user/login'),
>('/default/user/$anything', '/default/user/$anything'),
>('/default/$anything', '/default/$anything'),
>   ('/static/$anything', '/ids/static/$anything'),
>   ('/appadmin/$anything', '/ids/appadmin/$anything'),
>   ('/favicon.ico', '/ids/static/favicon.ico'),
>   ('/robots.txt', '/ids/static/robots.txt'),
>
>
>("/servers/index.html","/ids/servers/index.html"),
>   ("/servers/index.json","/ids/servers/index.json"),
>("/servers/$hostname","/ids/servers/view?NAME=$hostname"),
> *   ("/servers/$hostname.json","/ids/servers/view.json?NAME=$hostname"),*
>("/servers/$hostname.html","/ids/servers/view.html?NAME=$hostname"),
>('/servers/$anything', '/servers/$anything'),
>
> )
>
> routes_out = [(x, y) for (y, x) in routes_in]
>
>

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


[web2py] problems with hyphens in URL using routes.py

2018-11-01 Thread Thomas Klopf
Hello,
 Please can someone help with a routing problem? I'm using pattern-based 
routing (config below), mainly to map for example: 

"/servers/server-123.json" to "/ids/servers/view.json?NAME=server-123"

using routes.py entry:

   ("/servers/$hostname.json","/ids/servers/view.json?NAME=$hostname")


It works fine with "NAME=server" but if I have "NAME=server-123" 
(/servers/servers-123.json) , I get an "invalid request" error. It looks 
this is due to a restriction on having hyphens in application names and/or 
issues parsing with hyphens in the name.

Please can anyone suggestion an alternative configuration, to allow hyphens 
in the URL parameters?

Thank you!


*web2py/routes.py*

# -*- coding: utf-8 -*-
# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
#


# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
#
default_application = 'ids'# ordinarily set in base routes.py
default_controller = 'default'  # ordinarily set in app-specific routes.py
default_function = 'index'  # ordinarily set in app-specific routes.py

# routes_app is a tuple of tuples.  The first item in each is a regexp that 
will
# be used to match the incoming request URL. The second item in the tuple is
# an applicationname.  This mechanism allows you to specify the use of an
# app-specific routes.py. This entry is meaningful only in the base 
routes.py.
#
# Example: support welcome, admin, app and myapp, with myapp the default:


routes_app = ((r'/(?Pwelcome|admin|ids)\b.*', r'\g'),
  (r'(.*)', r'ids'),
  (r'/?(.*)', r'ids'))



*web2py/applications/ids/routes.py*
# -*- coding: utf-8 -*-
# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
#

default_application = 'ids'# ordinarily set in base routes.py
# default_controller = 'default'  # ordinarily set in app-specific routes.py
# default_function = 'index'  # ordinarily set in app-specific routes.py
# routes_app is a tuple of tuples.  The first item in each is a regexp that 
will
# be used to match the incoming request URL. The second item in the tuple is
# an applicationname.  This mechanism allows you to specify the use of an
# app-specific routes.py. This entry is meaningful only in the base 
routes.py.
#
# Example: support welcome, admin, app and myapp, with myapp the default:
#
#
# routes_app = ((r'/(?Padmin|gio_sds)', r'\g'),
#   (r'(.*)', r'gio_sds'),
#   (r'/?(.*)', r'gio_sds'))


routes_in = (
  ('/admin/$anything', '/admin/$anything'),
   # ('/default/$anything', '/default/$anything'),
 ('/default/user/login.json', '/ids/default/user/login'),
   ('/default/user/$anything', '/default/user/$anything'),
   ('/default/$anything', '/default/$anything'),
  ('/static/$anything', '/ids/static/$anything'),
  ('/appadmin/$anything', '/ids/appadmin/$anything'),
  ('/favicon.ico', '/ids/static/favicon.ico'),
  ('/robots.txt', '/ids/static/robots.txt'),


   ("/servers/index.html","/ids/servers/index.html"),
  ("/servers/index.json","/ids/servers/index.json"),
   ("/servers/$hostname","/ids/servers/view?NAME=$hostname"),
*   ("/servers/$hostname.json","/ids/servers/view.json?NAME=$hostname"),*
   ("/servers/$hostname.html","/ids/servers/view.html?NAME=$hostname"),
   ('/servers/$anything', '/servers/$anything'),

)

routes_out = [(x, y) for (y, x) in routes_in]

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


[web2py] Re: SQLFROM.grid sumarize option - totalization

2018-11-01 Thread Ari Lion BR Sp
Hi, Any comment about it?

:-)

Ari

Em quinta-feira, 11 de outubro de 2018 09:11:39 UTC-3, Ari Lion BR Sp 
escreveu:
>
> Hi, 
>
> a long time already I ask myself why SQLFROM.grid doesnt have a sumarize 
> option, mainly bacause I use it very often to be the Detail part of a 
> Master & Detail structure.
>
> I understand that the Grid is very often used as  a long list (a very long 
> list, and paginated), so somarize totals would not be intrestng. But why 
> not to give possibility to allow totalization of float type columns when 
> its used at short lists, what often happen when its used as a detail in a 
> M structure?
>
>
> Thanks
>

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


[web2py] Re: Mongodb Error

2018-11-01 Thread lbjc1978
turns out to be a password issue.
'db = DAL('mongodb://localhost/connect_test')' 

works well

On Tuesday, 30 October 2018 23:37:23 UTC+3, 黄祥 wrote:
>
> from the error traceback seems like a problem with a connection to 
> mongodb, wrong password or username, pls ensure the authentication to 
> mongodb connection is correct
>
> best regards,
> stifan
>

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