Yes, I think web2py allow this : db(db.where_clause).select() But there is nothing like being explicit... In SQL this won't work :
SELECT FROM table_name WHERE table_name.field_name = something So... Richard On Thu, Dec 17, 2015 at 4:23 PM, Gael Princivalle <[email protected] > wrote: > Thanks Anthony. In fact db_phplist tables where commented. Sorry. > > Thanks Richard. > With: > db_phplist.phplist_listuser.ALL ticket was an SQL error: > > ProgrammingError: (1064, "You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right syntax to > use near ' phplist_listuser.userid, phplist_listuser.listid ORDER BY > phplist_listuser.id' at line 1") > > > But with: > db_phplist.phplist_listuser.id>0 > It works. > > > Regards. > > Il giorno giovedì 17 dicembre 2015 21:54:48 UTC+1, Richard ha scritto: >> >> Could it be because in your select inside your function you not >> specifying any fields/columns (should be db_phplist.phplist_listuser.ALL) >> >> Also you have a mix of db and db_phplist is the latter defined somewhere? >> >> Richard >> >> On Thu, Dec 17, 2015 at 3:28 PM, Anthony <[email protected]> wrote: >> >>> Hard to say without more context, but looks like there is no >>> phplist_user_user table defined on the db_phplist DAL object. >>> >>> Anthony >>> >>> >>> On Thursday, December 17, 2015 at 3:18:34 PM UTC-5, Gael Princivalle >>> wrote: >>>> >>>> >>>> Hello. >>>> >>>> I was running this script without problems with 2.9.13: >>>> >>>> def add_phplist_user(f,id): >>>> auth_user = db.auth_user(id) >>>> #add user >>>> last_id = db_phplist.phplist_user_user.insert( >>>> email = auth_user.email, >>>> confirmed = auth_user.newsletter) >>>> phplist_listuser = db_phplist(db_phplist.phplist_listuser).select( >>>> orderby=db_phplist.phplist_listuser.id) >>>> last_phplist_listuser = phplist_listuser.last() >>>> db_phplist.phplist_listuser.insert( >>>> id = last_phplist_listuser.id + 1, >>>> userid = last_id, >>>> listid = 2) >>>> >>>> db.auth_user._after_insert.append(lambda f,id: add_phplist_user(f,id)) >>>> >>>> Now with 2.12.3 I have this ticket: >>>> <type 'exceptions.AttributeError'> Versione web2py™ Version >>>> 2.12.3-stable+timestamp.2015.08.19.00.18.03 Python Python 2.7.5: >>>> /usr/local/bin/python (prefix: /usr) Traceback >>>> >>>> 1. >>>> 2. >>>> 3. >>>> 4. >>>> 5. >>>> 6. >>>> 7. >>>> 8. >>>> 9. >>>> 10. >>>> 11. >>>> 12. >>>> 13. >>>> 14. >>>> 15. >>>> 16. >>>> 17. >>>> 18. >>>> 19. >>>> 20. >>>> 21. >>>> 22. >>>> 23. >>>> 24. >>>> 25. >>>> 26. >>>> >>>> Traceback (most recent call last): >>>> File "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/restricted.py", line >>>> 227, in restricted >>>> exec ccode in environment >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/applications/mompala_negozio_bio_torino/controllers/default.py" >>>> >>>> <https://prod.tasko.it/admin/edit/mompala_negozio_bio_torino/controllers/default.py>, >>>> line 508, in <module> >>>> File "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/globals.py", line 412, >>>> in <lambda> >>>> self._caller = lambda f: f() >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/applications/mompala_negozio_bio_torino/controllers/default.py" >>>> >>>> <https://prod.tasko.it/admin/edit/mompala_negozio_bio_torino/controllers/default.py>, >>>> line 470, in user >>>> return dict(website=website,form=auth()) >>>> File "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/tools.py", line 1614, >>>> in __call__ >>>> return getattr(self, args[0])() >>>> File "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/tools.py", line 2935, >>>> in register >>>> hideerror=self.settings.hideerror): >>>> File "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/sqlhtml.py", line >>>> 1711, in accepts >>>> self.vars.id = self.table.insert(**fields) >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/packages/dal/pydal/objects.py", >>>> line 715, in insert >>>> [f(fields, ret) for f in self._after_insert] >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/applications/mompala_negozio_bio_torino/models/db.py" >>>> >>>> <https://prod.tasko.it/admin/edit/mompala_negozio_bio_torino/models/db.py>, >>>> line 52, in <lambda> >>>> db.auth_user._after_insert.append(lambda f,id: add_phplist_user(f,id)) >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/applications/mompala_negozio_bio_torino/models/db.py" >>>> >>>> <https://prod.tasko.it/admin/edit/mompala_negozio_bio_torino/models/db.py>, >>>> line 42, in add_phplist_user >>>> last_id = db_phplist.phplist_user_user.insert( >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/packages/dal/pydal/base.py", >>>> line 906, in __getattr__ >>>> return super(DAL, self).__getattr__(key) >>>> File >>>> "/home/tasko/webapps/w2p_2_12_3/web2py/gluon/packages/dal/pydal/helpers/classes.py", >>>> line 30, in __getattr__ >>>> raise AttributeError >>>> AttributeError >>>> >>>> >>>> Someones knows why? >>>> >>>> Thanks, regards. >>>> >>>> Il giorno venerdì 7 agosto 2015 18:59:13 UTC+2, Massimo Di Pierro ha >>>> scritto: >>>>> >>>>> Changelog: >>>>> >>>>> - security fix: Validate for open redirect everywhere, not just in >>>>> login() >>>>> >>>>> - allow to pack invidual apps and selected files as packed exe files >>>>> >>>>> - allow bulk user registration with default bulk_register_enabled=False >>>>> >>>>> - allow unsorted multiword query in grid search >>>>> >>>>> - better MongoDB support with newer pyDAL >>>>> >>>>> - enable <app>/appadmin/manage/auth by default for user admin >>>>> >>>>> - allow mail.settings.server='logging:filename' to log emails to a file >>>>> >>>>> - better caching logic >>>>> >>>>> - fixed order of confirm-password field >>>>> >>>>> - TLS support in ldap >>>>> >>>>> - prettydate can do UTC >>>>> >>>>> - jquery 1.11.3 >>>>> >>>>> - bootstrap 3.3.5 >>>>> >>>>> - moved to codecov and enabled appveyor >>>>> >>>>> - many bug fixes >>>>> >>>>> >>>>> I am sure I am missing many important changes. Thanks to Niphlod, >>>>> Paolo, Giovanni, Leonel, Mark, Tim, Anthony, Cassio, Stephen, and all >>>>> those >>>>> who's names I do not know or I do not remember but who are giving so much >>>>> to web2py. >>>>> >>>>> >>>>> Thank you! >>>>> >>>>> >>>>> 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 [email protected]. >>> 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

