[web2py] Re: passing additional variables in selectable function of sqlform.grid
I tried this but it didn't work. form=SQLFORM.grid(db.Student, editable=False, deletable=False, showbuttontext=False, selectable = [('Assign', lambda ids : assign(ids, form))], csv=False) form.append(SQLFORM.factory(Field('Class', 'reference Class', requires=IS_IN_DB(db, db.Class.id, '%(Class)s'))) submit = form.element('input',_type='submit', _value='Submit') submit['_style'] = 'display:none;' return dict(form=form) def assign(ids, form): for id in ids: db.StudentClass.insert(Class=form.vars.Class, Student=id) Any help? -- 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: response.js does not execute in the oncreate callback
Hi Massimo, done. The issue is #1693 Try to take a look at it please, thank you! El sábado, 22 de julio de 2017, 15:35:57 (UTC-5), Massimo Di Pierro escribió: > > Please open a ticket about this it gets tracked. > > On Thursday, 20 July 2017 20:43:40 UTC-5, Bernardo Leon wrote: >> >> Hello, I have a component which has an SQLFORM.grid and an oncreate and >> ondelete callbacks on which I execute a response.js. When I delete a record >> the response.js javascript function is executed but when I create a record >> the response.js javascript function does not get executed (but the python's >> oncreate function gets executed) >> >> This is my controller code: >> >> def oncreate_empleado(form): >> # This method executes but the response_gestor_empleados javascript >> function is not executed >> response.js = 'response_gestor_empleados(%i);' % form.vars.id >> >> >> def ondelete_empleado(table, id): >> # Here the response_gestor_empleados javascript function gets executed >> response.js = 'response_gestor_empleados(5);' >> >> >> def index(): >> >> grid_empleados = SQLFORM.grid(db.empleado, >> orderby=[db.empleado.apellidos, >> db.empleado.nombres], >> links=[dict(header='', >> body=lambda registro: >> crear_boton_seleccionar_empleado(registro))], >> details=False, >> csv=False, >> formname='grid_empleados', >> oncreate=oncreate_empleado, >> ondelete=ondelete_empleado) >> >> return dict(grid_empleados=grid_empleados) >> >> Is this a bug or am I doing something wrong? Thank you! >> > -- 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: web2py 2.15.2 is OUT
Thank you Tim. On Friday, 21 July 2017 03:42:09 UTC-5, tim.nyb...@conted.ox.ac.uk wrote: > > Actually, this should be simple enough that I can post a fix. > > On Friday, 21 July 2017 09:35:34 UTC+1, tim.n...@conted.ox.ac.uk wrote: >> >> Creating a SQLFORM.factory() from tables, or a combination of tables and >> fields, now breaks, because the underlying logic assumes the tables are >> fields: >> >> form = SQLFORM.factory(idb.catering, idb.catering_diet) >> >> File "/home/www-data/internal-apps/gluon/sqlhtml.py", line 1922, in factory >> return SQLFORM(DAL(None).define_table(table_name, *[field.clone() for >> field in fields]), >> AttributeError: 'Table' object has no attribute 'clone' >> >> >> On Wednesday, 19 July 2017 13:25:52 UTC+1, Massimo Di Pierro wrote: >>> >>> web2py 2.15.2 is OUT is includes a few major bug fixes to version >>> 2.15.1. Thanks Leonel for the quick fixes. >>> There a few other outstanding problems and they will be resolved in the >>> next week. >>> >>> For new users 2.15.2 is still better than previous versions. For current >>> users, please check it out and continue to report any problem. We want to >>> make sure it is backward compatible as promised. >>> >>> Massimo >>> >>> -- 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: response.js does not execute in the oncreate callback
Please open a ticket about this it gets tracked. On Thursday, 20 July 2017 20:43:40 UTC-5, Bernardo Leon wrote: > > Hello, I have a component which has an SQLFORM.grid and an oncreate and > ondelete callbacks on which I execute a response.js. When I delete a record > the response.js javascript function is executed but when I create a record > the response.js javascript function does not get executed (but the python's > oncreate function gets executed) > > This is my controller code: > > def oncreate_empleado(form): > # This method executes but the response_gestor_empleados javascript > function is not executed > response.js = 'response_gestor_empleados(%i);' % form.vars.id > > > def ondelete_empleado(table, id): > # Here the response_gestor_empleados javascript function gets executed > response.js = 'response_gestor_empleados(5);' > > > def index(): > > grid_empleados = SQLFORM.grid(db.empleado, > orderby=[db.empleado.apellidos, > db.empleado.nombres], > links=[dict(header='', > body=lambda registro: > crear_boton_seleccionar_empleado(registro))], > details=False, > csv=False, > formname='grid_empleados', > oncreate=oncreate_empleado, > ondelete=ondelete_empleado) > > return dict(grid_empleados=grid_empleados) > > Is this a bug or am I doing something wrong? Thank you! > -- 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: Is it possible to set Cache-Control: no-cache using @cache.action decorator?
I've found that this is possible with a very simple modification to gluons/cache.py: https://github.com/gonguinguen/web2py/commit/93cd4b9fa18788dd3b6cb3087f87a71a967aaa85 I don't know if I did right proposing that change. Anyway, I just wanted to comment in case someone runs into some similar situation. For the moment, I will instantiate Cache class and make my own cache object, that is, my own @cache.action decorator. Regards, Lisandro El viernes, 21 de julio de 2017, 15:24:33 (UTC-3), Lisandro escribió: > > Maybe my question is wrong because of some background that I'm not seeing. > Due to the structure of my app, I use @cache.action like this in all my > controller functions: > > @cache.action(cache_model=CACHE.model, time_expire=CACHE.time_expire, > session=CACHE.session, vars=CACHE.vars, public=CACHE.public) > def index(): > # code here > > In my model, I define the CACHE object with the proper attributes, > depending on several situations (logged in or not, certain permissions, > specific scenarios). The thing is that, *in some cases I need to set the > response headers as if I hadn't use @cache.action*. I've tried to set > cache_model=None and time_expire=None, but it throws the following error: > > Traceback (most recent call last): > File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted > exec ccode in environment > File "/home/gonguinguen/medios/applications/mazar/controllers/default.py", > line 463, in > File "/home/gonguinguen/medios/gluon/globals.py", line 417, in > self._caller = lambda f: f() > File "/home/gonguinguen/medios/gluon/cache.py", line 669, in wrapped_f > 'Expires': expires, > UnboundLocalError: local variable 'expires' referenced before assignment > > > > I mean, if I dont use @cache.action, then Cache-Control header has the > following value: > no-store, no-cache, must-revalidate, post-check=0, pre-check=0 > > But I can't generate that same response header using @cache.action. > Wouldn't be nice if we could pass time_expire=0 and cache_model=None to > set those headers? > > In anycase, how can I solve it? Would I need a custom decorator? Would it > be possible to instantiate and rewrite the default cache.action behaviour? > > Thanks in advance! > Regards, > Lisandro > -- 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] Web2py Docker
I have been using this in production for more than one year https://hub.docker.com/r/jredrejo/web2py/ 2017-07-22 3:43 GMT+02:00 : > I've searched through the discussion archive before posting this question. > There were few threads here and there but nothing definitive. > > Please share your experience with using the web2py docker image. Can you > recommend a docker image(s) that you've been using in production? > > Thanks, > CD > > -- > 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] grid for data entry
I want data to be captured for tdr_bid_unrev_detls.rate. I have the query below. select d.jcod,d.qty,u.rate,u.amt from tdr_tender_master t join amc_master m on t.amc_id = m.id join amc_details d on m.id = d.amc_id left join tdr_bid_unrev_detls u on u.tdr_id = t.id and u.amc_id = m.id where m.id = 15 This returns the result jcod qty rateamt cs00110.00NULLNULL cs01010.00NULLNULL cstest10.00NULLNULL cs00210.00NULLNULL asd 2.00NULLNULL cs004 5.00 NULLNULL test1 10.00 NULLNULL Now I would like to fill the rate in the above result in a grid generated by the above query. I tried this in controller tdrid = request.vars.tdrid query = (db.tdr_tender_master.id==tdrid) & (db.tdr_tender_master.amc_id == db.amc_master.id) & (db.amc_master.id == db.amc_details.amc_id) & (db.tdr_bid_unrev_detls.tdr_id == db.tdr_tender_master.id) left=db.tdr_bid_unrev_detls.on(db.tdr_tender_master.id == db.tdr_bid_unrev_detls.tdr_id) form = SQLFORM.grid(query,left=left) but i dont get the required form. I want to populate the tdr_bid_unrev_detls table. I am not able to do it myself reading the book. So pl. help. Thanks and regards. -- 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.