Re: [web2py] Re: Web3py
Traceback (most recent call last): File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 460, in import_apps module = importlib.import_module(app_name) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/importlib/__init__.py" , line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/sugizo/learn/python/web3py/applications/_scaffold/__init__.py", line 1, in from . import controllers File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/reloader.py" , line 158, in _import base = _baseimport(name, globals, locals, fromlist, level) File "/Users/sugizo/learn/python/web3py/applications/_scaffold/controllers.py", line 3, in from . import models File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/reloader.py" , line 158, in _import base = _baseimport(name, globals, locals, fromlist, level) File "/Users/sugizo/learn/python/web3py/applications/_scaffold/models.py", line 8, in pool_size=settings.DB_POOL_SIZE) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py" , line 171, in __call__ obj = super(MetaDAL, cls).__call__(*args, **kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py" , line 477, in __init__ "Failure to connect, tried %d times:\n%s" % (attempts, tb) RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last): File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py" , line 457, in __init__ self._adapter = adapter(**kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/__init__.py" , line 39, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py" , line 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py" , line 53, in __init__ self.reconnect() File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/connection.py" , line 154, in reconnect self.connection = self.connector() File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/sqlite.py" , line 42, in connector return self.driver.Connection(self.dbpath, **self.driver_args) sqlite3.OperationalError: unable to open database file Bottle v0.12.16 server starting up (using WSGIRefServer())... Listening on http://127.0.0.1:8000/ Hit Ctrl-C to quit. 127.0.0.1 - - [22/Apr/2019 03:08:12] "GET /dashboard HTTP/1.1" 303 0 127.0.0.1 - - [22/Apr/2019 03:08:12] "GET /_dashboard/static/index.html HTTP/1.1" 404 459 127.0.0.1 - - [22/Apr/2019 03:08:56] "GET /_dashboard/ HTTP/1.1" 404 459 127.0.0.1 - - [22/Apr/2019 03:09:31] "GET /_dashboard/dashboard HTTP/1.1" 404 459 127.0.0.1 - - [22/Apr/2019 03:09:35] "GET /_dashboard/info HTTP/1.1" 200 127.0.0.1 - - [22/Apr/2019 03:09:59] "GET /_dashboard/routes HTTP/1.1" 200 2711 127.0.0.1 - - [22/Apr/2019 03:10:21] "GET /_dashboard/apps HTTP/1.1" 200 3410 127.0.0.1 - - [22/Apr/2019 03:11:00] "GET /_scaffold HTTP/1.1" 404 457 127.0.0.1 - - [22/Apr/2019 03:11:33] "GET /_scaffold/index HTTP/1.1" 404 457 *step* rm -rf ~/learn/python/web3py cd ~/learn/python git clone https://github.com/web2py/web3py cd ~/learn/python/web3py source activate python3_test pip install -U -r requirements.txt python web3py-start applications/ 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.
Re: [web2py] Re: Web3py
I was wrong.. Found a recent integration with bottle and oauthlib.. https://github.com/thomsonreuters/bottle-oauthlib/blob/master/README.md Now we only need to figure out jwt and easy rest crud.. Which bottle is perfect for and finally use the before mentioned openapi generator with bottle and we are good to go. On Sun, 21 Apr 2019, 12:05 Kevin Keller, wrote: > Authentication + authorization and documentation of endpoints are actually > the hardest part. > > There is a. Flask based framework called connexxion which asks you to > create the openapi spec before the code which has jwt and oauth2 build in > as. Well. > > > Then there are flask Rebar which can use jwt and auth0 build in . Also > gernatrss openapi 2 documentation. > > And there is Sars., also a Flask based framework thst generates openapi 2 > documentation and can easily extend with jwt and oauth2 via flask plug-ins. > > There is also hug, based on the falcon framework.. Also generates openapi > v2 documentation and has an oauth2 plugin and does jwt build in. > > Thus I was thinking to bring up this topic early. > > Bottle does not have this kind of out of the box suopport, but there is a > framework agnostic openapi generator we could use : > https://apispec.readthedocs.io/en/stable/ > > And we could create a oauth2 plugin for bottle (the current one is > deprecated) based on authlib. > Authlib also has the ability to generate jwt tokens, but for standalone > tokens we could use pyjwt I guess. > > When we scaffold crud apis and vue frontends with authentication in place > thst would be great just as it was with web2py by just using a decorator I. > E. Crud api routes and functions and authentication via tokens and/or > oauth2. > > The openapi makes it easy to collaborate with others in Microservice > environment and also gives users the ability to generate UIs sich as with > angular and react based on openapi specs Web3py generated for thr enpoints. > > > > > > On Sun, 21 Apr 2019, 04:03 黄祥, wrote: > >> scaffolding app would be nice to have example of authentication (user >> registration, login and logout) and to update the data, e.g. update todo >> list on todo app >> just wondering, if form used manually using javascript, is the field >> validation on pydal, still can work ? e.g. requires=IS_NOT_EMPTY() >> >> 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. >> > -- 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: Python3 GAE 502 Error
Or may be what i need is just to know what is the entrypoint in the app.yalm for my web2py application runtime: python37 entrypoint: gunicorn -b :$PORT main:app El domingo, 21 de abril de 2019, 18:19:59 (UTC+2), Jacinto Parga escribió: > > The first issue (fatal:ambiguous argument'HEAD') solved just with git > init. > > The second one 'Bad Gateway' in google app engine with python3.7 not yet. > > May be this solution valid for web2py) > https://stackoverflow.com/questions/54565417/error-bad-gateway-502-when-opening-google-app-engine-python-domain > > > > > El jueves, 18 de abril de 2019, 14:21:41 (UTC+2), Jacinto Parga escribió: >> >> Hi, >> >> I'm trying to deploy my first python3 app in Google App Engine. I've >> edited app.yaml according to >> https://cloud.google.com/appengine/docs/standard/python3/config/appref . >> I have created .gcloudignore replacing skip files and I have deployed it >> gcloud app deploy app.yaml --version --promote >> >> But what I get is >> >> Beginning deployment of service [default]... >> fatal:ambiguous argument'HEAD': unknown revision or path outside the >> working tree. >> Use '--' to separate the routes of the revisions, in this way: >> 'git [...] -- [...]' >> >> I vhave checked that all the files are uploaded wrght to Google App >> Engine, but when I access to the app: >> >> [image: bad-gateway-502.png] >> I dont know if it is an app.yaml mistale or there is somethin wrong in >> web2py with python3 apps in GAE. >> >> 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: Unable to edit grid record if I add @auth.requires_signature() to action. Is this normal?
Here is the correct version (my previous post, which I deleted, was another version): #@auth.requires_signature() @auth.requires_login() def index(): # type: () -> Dict[str, gluon.DIV] """Index page. :return: Dict with grid. """ if session.return_to: del session.return_to session.table = 'opt_cat' # Hidden fields in grid and edit/view form. db.opt_cat.id.readable = False db.opt_cat.one_opt_only.show_if = db.opt_cat.mandatory == False if SUPERVISOR_ROLE_ID in auth.user_groups: # Uses covering index opt_cat_is_active_name_en. # Uses auto index sqlite_autoindex_opt_cat_1. grid = SQLFORM.grid( db.opt_cat, csv=False, details=False, # Disable delete checkbox in edit form. editargs=dict(deletable=False), maxtextlength=GRID_COL_LEN_FOR_TEXT, ondelete=on_delete, # Grid only. onvalidation=on_validation, # And onupdate are form only. orderby=db.opt_cat.name, paginate=session.auth.user.pagination, # represent_none='', # Grid and view form only. ) # type: gluon.DIV else: # Hidden fields in grid and edit/view form. db.opt_cat.canceled_on.readable = False db.opt_cat.canceled_by.readable = False db.opt_cat.cancel_approved_by.readable = False # Uses covering index opt_cat_is_active_name_en (is_active=?). # Uses index opt_cat_is_active_name (is_active=?). grid = SQLFORM.grid( db.opt_cat.is_active == True, create=False, csv=False, deletable=False, details=False, editable=False, maxtextlength=GRID_COL_LEN_FOR_TEXT, orderby=db.opt_cat.name, paginate=session.auth.user.pagination, # represent_none='', # Grid and view form only. ) # Remove icons from default buttons. grid.elements('span.icon', replace=None) if request.args: # Remove delete button. grid.element('#delete_with_approval', replace=None) if not request.args: # Sort grid's search fields list. grid.element('#w2p_query_fields').components = sort_grid_search_fields_list(grid) if session.opt_cat_modified_on: del session.opt_cat_modified_on elif 'edit' in request.args: # Edit uses opt_cat Pk. form = grid.update_form # type: gluon.sqlhtml.SQLFORM # form['hidden'].update(mon=form.record.modified_on) # Solves the record changed while editing, but doesn't solve it # if the user 1st tries something that returns form.errors (eg. # changing a unique field to something that already exists) and # only after that he tries to save the record (which was changed # by another user). For this the only solution I've found was # using a session var. if not session.opt_cat_modified_on: session.opt_cat_modified_on = form.record.modified_on if not form.record.is_active and not SUPERVISOR_ROLE_ID in auth. user_groups: session.flash = T('Record was deleted while you were viewing the grid.') redirect(URL(user_signature=True)) return dict(grid=grid) domingo, 21 de Abril de 2019 às 17:22:44 UTC+1, Anthony escreveu: > > On Sunday, April 21, 2019 at 10:53:08 AM UTC-4, João Matos wrote: >> >> I wanted to have signed URL everywhere. >> For that, I added user_signature=True to all my URL(). The grid has that >> as a default. >> At this point everything worked with @requires_login() except one special >> case (I believe this special case may be related to the same issue I'm >> facing with this I describe here). >> >> Then I added a var called sid (for session id) to every URL() which I use >> to identify the session (this way I'm able to distinguish ebetween 2 >> browser tabs). >> At this point everything worked with @requires_login() except the special >> case I mentioned above. >> >> Then I replaced @auth.requires_login() with @auth.requires_signature() >> and I'm able to access the grid but not the edit form. I receive a Not >> Authorized message. >> >> In all these tests I'm logged in. >> >> If I remove the sid var and keep the @auth.requires_signature() >> everything works. >> >> If I replace the@auth.requires_signature() with @auth.requires_login() >> and keep the sid var everything works. >> >> Only the combination of both doesn't work. >> > > Need to see the code. > -- 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.
[web2py] Re: Unable to edit grid record if I add @auth.requires_signature() to action. Is this normal?
Here it is: @auth.requires_login() # @auth.requires_signature() def index(): # type: () -> Dict[str, gluon.DIV] """Index page. :return: Dict with grid. """ if not request.vars.sid: redirect(URL('default', 'index')) if session.sids[request.vars.sid].return_to: del session.sids[request.vars.sid].return_to session.sids[request.vars.sid].table = 'opt_cat' # Hidden fields in grid and edit/view form. db.opt_cat.id.readable = False db.opt_cat.one_opt_only.show_if = db.opt_cat.mandatory == False if SUPERVISOR_ROLE_ID in auth.user_groups: # Uses covering index opt_cat_is_active_name_en. # Uses auto index sqlite_autoindex_opt_cat_1. grid = SQLFORM.grid( db.opt_cat, csv=False, details=False, # Disable delete checkbox in edit form. editargs=dict(deletable=False), maxtextlength=GRID_COL_LEN_FOR_TEXT, ondelete=on_delete, # Grid only. onvalidation=on_validation, # And onupdate are form only. orderby=db.opt_cat.name, paginate=session.auth.user.pagination, # represent_none='', # Grid and view form only. user_signature=False, ) # type: gluon.DIV else: # Hidden fields in grid and edit/view form. db.opt_cat.canceled_on.readable = False db.opt_cat.canceled_by.readable = False db.opt_cat.cancel_approved_by.readable = False # Uses covering index opt_cat_is_active_name_en (is_active=?). # Uses index opt_cat_is_active_name (is_active=?). grid = SQLFORM.grid( db.opt_cat.is_active == True, create=False, csv=False, deletable=False, details=False, editable=False, maxtextlength=GRID_COL_LEN_FOR_TEXT, orderby=db.opt_cat.name, paginate=session.auth.user.pagination, # represent_none='', # Grid and view form only. user_signature=False, ) # Remove icons from default buttons. grid.elements('span.icon', replace=None) if request.args: # Remove delete button. grid.element('#delete_with_approval', replace=None) if not request.args: # Sort grid's search fields list. grid.element('#w2p_query_fields').components = sort_grid_search_fields_list(grid) if session.sids[request.vars.sid].modified_on: del session.sids[request.vars.sid].modified_on elif 'edit' in request.args: # Edit uses opt_cat Pk. form = grid.update_form # type: gluon.sqlhtml.SQLFORM # form['hidden'].update(mon=form.record.modified_on) # Solves the record changed while editing, but doesn't solve it # if the user 1st tries something that returns form.errors (eg. # changing a unique field to something that already exists) and # only after that he tries to save the record (which was changed # by another user). For this the only solution I've found was # using a session var. if not session.sids[request.vars.sid].modified_on: session.sids[request.vars.sid].modified_on = form.record. modified_on if not form.record.is_active and not SUPERVISOR_ROLE_ID in auth. user_groups: session.flash = T('Record was deleted while you were viewing the grid.') redirect(URL(vars={'sid': request.vars.sid})) return dict(grid=grid) -- 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: Unable to edit grid record if I add @auth.requires_signature() to action. Is this normal?
On Sunday, April 21, 2019 at 10:53:08 AM UTC-4, João Matos wrote: > > I wanted to have signed URL everywhere. > For that, I added user_signature=True to all my URL(). The grid has that > as a default. > At this point everything worked with @requires_login() except one special > case (I believe this special case may be related to the same issue I'm > facing with this I describe here). > > Then I added a var called sid (for session id) to every URL() which I use > to identify the session (this way I'm able to distinguish ebetween 2 > browser tabs). > At this point everything worked with @requires_login() except the special > case I mentioned above. > > Then I replaced @auth.requires_login() with @auth.requires_signature() and > I'm able to access the grid but not the edit form. I receive a Not > Authorized message. > > In all these tests I'm logged in. > > If I remove the sid var and keep the @auth.requires_signature() everything > works. > > If I replace the@auth.requires_signature() with @auth.requires_login() and > keep the sid var everything works. > > Only the combination of both doesn't work. > Need to see the code. -- 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: Python3 GAE 502 Error
The first issue (fatal:ambiguous argument'HEAD') solved just with git init. The second one 'Bad Gateway' in google app engine with python3.7 not yet. May be this solution valid for web2py) https://stackoverflow.com/questions/54565417/error-bad-gateway-502-when-opening-google-app-engine-python-domain El jueves, 18 de abril de 2019, 14:21:41 (UTC+2), Jacinto Parga escribió: > > Hi, > > I'm trying to deploy my first python3 app in Google App Engine. I've > edited app.yaml according to > https://cloud.google.com/appengine/docs/standard/python3/config/appref . > I have created .gcloudignore replacing skip files and I have deployed it > gcloud app deploy app.yaml --version --promote > > But what I get is > > Beginning deployment of service [default]... > fatal:ambiguous argument'HEAD': unknown revision or path outside the > working tree. > Use '--' to separate the routes of the revisions, in this way: > 'git [...] -- [...]' > > I vhave checked that all the files are uploaded wrght to Google App > Engine, but when I access to the app: > > [image: bad-gateway-502.png] > I dont know if it is an app.yaml mistale or there is somethin wrong in > web2py with python3 apps in GAE. > > 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: Where do I find the user/profiel and user/change_password forms?
Thanks Anthony. domingo, 21 de Abril de 2019 às 13:54:32 UTC+1, Anthony escreveu: > > On Sunday, April 21, 2019 at 7:32:50 AM UTC-4, João Matos wrote: >> >> I'd like to make changes to the user/profile and user/change_password >> forms, but I can't find them. >> > > In the associated methods in tools.py: > > https://github.com/web2py/web2py/blob/master/gluon/tools.py#L3646 > -- 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: Unable to edit grid record if I add @auth.requires_signature() to action. Is this normal?
I wanted to have signed URL everywhere. For that, I added user_signature=True to all my URL(). The grid has that as a default. At this point everything worked with @requires_login() except one special case (I believe this special case may be related to the same issue I'm facing with this I describe here). Then I added a var called sid (for session id) to every URL() which I use to identify the session (this way I'm able to distinguish ebetween 2 browser tabs). At this point everything worked with @requires_login() except the special case I mentioned above. Then I replaced @auth.requires_login() with @auth.requires_signature() and I'm able to access the grid but not the edit form. I receive a Not Authorized message. In all these tests I'm logged in. If I remove the sid var and keep the @auth.requires_signature() everything works. If I replace the@auth.requires_signature() with @auth.requires_login() and keep the sid var everything works. Only the combination of both doesn't work. domingo, 21 de Abril de 2019 às 14:07:42 UTC+1, Anthony escreveu: > > Can you show your code? I cannot reproduce this exact behavior. > > Note, because the default behavior of @auth.requires_signature() is to > include the query string when creating the signature, any functionality of > the grid that uses the query string should not work, as the grid does not > generate signatures for those links. > > In any case, the grid already has built-in support for signed URLs for any > write operations -- do you need more than that? > > Anthony > > On Saturday, April 20, 2019 at 4:03:17 PM UTC-4, João Matos wrote: >> >> If I replace @auth_requires_login() with @auth.requires_signature() to my >> index function (controller's main function) where a grid is created, the >> grid shows up without any issue, but if I try to edit a row, I get a Not >> Authorized message. >> >> Anyone has any idea why this is happening? >> >> If I replace @auth.requires_signature() with @auth.requires_login() >> everything works. >> > -- 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: Unable to edit grid record if I add @auth.requires_signature() to action. Is this normal?
Can you show your code? I cannot reproduce this exact behavior. Note, because the default behavior of @auth.requires_signature() is to include the query string when creating the signature, any functionality of the grid that uses the query string should not work, as the grid does not generate signatures for those links. In any case, the grid already has built-in support for signed URLs for any write operations -- do you need more than that? Anthony On Saturday, April 20, 2019 at 4:03:17 PM UTC-4, João Matos wrote: > > If I replace @auth_requires_login() with @auth.requires_signature() to my > index function (controller's main function) where a grid is created, the > grid shows up without any issue, but if I try to edit a row, I get a Not > Authorized message. > > Anyone has any idea why this is happening? > > If I replace @auth.requires_signature() with @auth.requires_login() > everything works. > -- 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: Where do I find the user/profiel and user/change_password forms?
On Sunday, April 21, 2019 at 7:32:50 AM UTC-4, João Matos wrote: > > I'd like to make changes to the user/profile and user/change_password > forms, but I can't find them. > In the associated methods in tools.py: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L3646 -- 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: SQLFORM.smartgrid selectable return string or list
You both are righ: What's work now (also should worke before): selectable=[('change price 100', lambda ids: modify_price(ids,100) ), ] and the function in the same controller: def modify_price(ids,inc): print request.vars.records print ids print inc Both request.vars.records and ids are lists also with only one selected Thanks for help On Sunday, April 21, 2019 at 1:56:09 AM UTC+2, Anthony wrote: > > On Saturday, April 20, 2019 at 8:52:01 AM UTC-4, icodk wrote: >> >> Hi Antony >> >> My selectable looks like : >> >> selectable = [('Add 100 to price',lambda ids: redirect(URL('product', >> 'modify_price', args=request.args, vars=dict(id=ids, inc=100, >> >> > Why do a redirect rather than simply doing the work in the same function? > Also, this redirect puts the ids in the URL query string, resulting in the > ultimate update being a GET request rather than a POST -- this is > undesirable because a refresh of that page will result in the entire > operation being repeated, which you don't want. > > >> >> and my function in the product controller looks like this: >> >> def modify_price(): >> >> if type(request.vars.id) is str: >> >> id_list = request.vars.id.split(',') #convertint to list >> >> else: >> >> id_list = request.vars.id >> >> db(db.product.id.belongs(id_list)).update(product_price=db.product.product_price+request.vars.inc) >> >> >> Simply following the documentation in the book >> >> I also tried: >> >> selectable= lambda ids: modify_price >> >> >> But the function neve called >> > > It's not that the function never gets called but that the function is not > written to work this way. The function expects to find ids in > request.vars.id, but that is actually None in the case where you call it > this way (the real values are in request.vars.records). Is modify_price a > controller action that needs to be accessible separately from this > particular operation? If not, just make it a helper function that accepts > an "ids" argument, and set selectable=modify_price. > > Anthony > -- 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] Where do I find the user/profiel and user/change_password forms?
I'd like to make changes to the user/profile and user/change_password forms, but I can't find them. -- 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.
Re: [web2py] Re: Web3py
Authentication + authorization and documentation of endpoints are actually the hardest part. There is a. Flask based framework called connexxion which asks you to create the openapi spec before the code which has jwt and oauth2 build in as. Well. Then there are flask Rebar which can use jwt and auth0 build in . Also gernatrss openapi 2 documentation. And there is Sars., also a Flask based framework thst generates openapi 2 documentation and can easily extend with jwt and oauth2 via flask plug-ins. There is also hug, based on the falcon framework.. Also generates openapi v2 documentation and has an oauth2 plugin and does jwt build in. Thus I was thinking to bring up this topic early. Bottle does not have this kind of out of the box suopport, but there is a framework agnostic openapi generator we could use : https://apispec.readthedocs.io/en/stable/ And we could create a oauth2 plugin for bottle (the current one is deprecated) based on authlib. Authlib also has the ability to generate jwt tokens, but for standalone tokens we could use pyjwt I guess. When we scaffold crud apis and vue frontends with authentication in place thst would be great just as it was with web2py by just using a decorator I. E. Crud api routes and functions and authentication via tokens and/or oauth2. The openapi makes it easy to collaborate with others in Microservice environment and also gives users the ability to generate UIs sich as with angular and react based on openapi specs Web3py generated for thr enpoints. On Sun, 21 Apr 2019, 04:03 黄祥, wrote: > scaffolding app would be nice to have example of authentication (user > registration, login and logout) and to update the data, e.g. update todo > list on todo app > just wondering, if form used manually using javascript, is the field > validation on pydal, still can work ? e.g. requires=IS_NOT_EMPTY() > > 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. > -- 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: Unable to edit grid record if I add @auth.requires_signature() to action. Is this normal?
You didn't understand. In both cases I'm logged in. If I have @requires_login() it all works. If I replace it with @requires_signature() the grid opens OK, but I'm unable to edit a record. The menu option I created to open the grid has the user_signature=True and the grid has the default of user_signature=True. domingo, 21 de Abril de 2019 às 00:53:07 UTC+1, Massimo Di Pierro escreveu: > > It is intentional. The grid requires a valid user to make field editable. > You can override this with: > > grid(..., user_signature=False) > > In any case if the user is not logged if you tables require a user > signature, those fields will not be automatically filled. > > On Saturday, 20 April 2019 13:03:17 UTC-7, João Matos wrote: >> >> If I replace @auth_requires_login() with @auth.requires_signature() to my >> index function (controller's main function) where a grid is created, the >> grid shows up without any issue, but if I try to edit a row, I get a Not >> Authorized message. >> >> Anyone has any idea why this is happening? >> >> If I replace @auth.requires_signature() with @auth.requires_login() >> everything works. >> > -- 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] How to create js function before web2py.js send data to server?
I need to validate data on page before send it to server, How to create js function before web2py.js send data to server? -- 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.