[web2py] Re: DAL query CONVERT field
In the trunk pyDAL version this should be possible: db(db.table1.field1.cast('text').like('%somestring%')).select(db.table1.ALL) While that's not available: from pydal.objects import Expression dialect = db._adapter.dialect db(Expression(db, dialect.cast, db.table1.field1, dialect.types['text'], 'text').like('%somestring%')).select() -- 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: 'FieldVirtual' object has no attribute 'listable'
Try to make the virtual field writable=False On Monday, March 12, 2018 at 9:04:07 PM UTC+1, Andrea Fae' wrote: > > I don't know because I'm sure mounths ago it was working... > > > form = SQLFORM.grid(query, args=[studente], fields=[db.evento.titolo, > db.evento.ricorrenza, db.evento.giorno_inizio, db.evento.inizio, > db.evento.fine, db.evento.risorsa, db.evento.materia, > db.evento.docente],headers=headers,create=False, details=False, > editable=False, deletable=False, searchable=False, maxtextlength=60, > exportclasses = exportcls) > > > this is the table... > > db.define_table('evento', > Field('titolo', requires=[IS_NOT_EMPTY()]), > Field('inizio', type='datetime'), > Field('fine', type='datetime'), > Field('uniqueid', type='string'), > Field('ricorrenza', requires = IS_IN_SET(['0', '1', '2', > '3', '4', '5', '6', '7', '8', '9', '10'], error_message='deve essere un > numero da 0 a 10'), default= '0'), > Field.Virtual('giorno_inizio', lambda > row:calendar.day_name[row.evento.inizio.weekday()]), > Field('risorsa', 'reference risorsa'), > Field('docente', 'reference auth_user'), > Field('materia', 'reference materia'), > Field('studenti', 'list:reference auth_user'), > Field('colore', default = '#8080ff'), > Field('controllato', type='boolean', default=False), > Field('note'), > > auth.signature,singular="Evento",plural="Eventi",migrate='evento.table', > format='%(titolo)s') > # questa impostazione serve per rappresentare inizio senza i secondi > db.evento.inizio.represent = lambda value, row: value.strftime("%d/%m/%Y > %H:%M") > db.evento.fine.represent = lambda value, row: value.strftime("%d/%m/%Y > %H:%M") > db.evento.giorno_inizio.represent = lambda giorno_inizio, row: > T(giorno_inizio) > > > I think it's a problem about the last version of web2py.. > -- 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] DAL query CONVERT field
Is possible to create a query in DAL to obtain this ? SELECT * FROM table1 WHERE CONVERT(VARCHAR, field1) LIKE '%somestring%' where field1 is an INT type field ? Thanks in advance. -- 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] web2py debugger breakpoint works once only in 2.16.1
This can be demonstrated with the welcome app. Start web2py Display the admin page, go into debug, breakpoints and set breakpoint on line 9 of the welcome app default.py Launch the welcome page - the breakpoint is hit. Click continue ... the welcome page displays The admin/breakpoint page still shows the breakpoint as set. Launch another welcome page - it displays without any breakpoint. Also, if you try to clear the breakpoint, it disappears from the admin/breakpoint page, however the console now shows an error: web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2018 Version 2.16.1-stable+timestamp.2017.11.14.05.54.25 Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000 please visit: http://127.0.0.1:8000/ starting browser... *** DO_CLEAR failed Non-numeric breakpoint number (all}) -- 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] 'FieldVirtual' object has no attribute 'listable'
I don't know because I'm sure mounths ago it was working... form = SQLFORM.grid(query, args=[studente], fields=[db.evento.titolo, db.evento.ricorrenza, db.evento.giorno_inizio, db.evento.inizio, db.evento.fine, db.evento.risorsa, db.evento.materia, db.evento.docente],headers=headers,create=False, details=False, editable=False, deletable=False, searchable=False, maxtextlength=60, exportclasses = exportcls) this is the table... db.define_table('evento', Field('titolo', requires=[IS_NOT_EMPTY()]), Field('inizio', type='datetime'), Field('fine', type='datetime'), Field('uniqueid', type='string'), Field('ricorrenza', requires = IS_IN_SET(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], error_message='deve essere un numero da 0 a 10'), default= '0'), Field.Virtual('giorno_inizio', lambda row:calendar.day_name[row.evento.inizio.weekday()]), Field('risorsa', 'reference risorsa'), Field('docente', 'reference auth_user'), Field('materia', 'reference materia'), Field('studenti', 'list:reference auth_user'), Field('colore', default = '#8080ff'), Field('controllato', type='boolean', default=False), Field('note'), auth.signature,singular="Evento",plural="Eventi",migrate='evento.table', format='%(titolo)s') # questa impostazione serve per rappresentare inizio senza i secondi db.evento.inizio.represent = lambda value, row: value.strftime("%d/%m/%Y %H:%M") db.evento.fine.represent = lambda value, row: value.strftime("%d/%m/%Y %H:%M") db.evento.giorno_inizio.represent = lambda giorno_inizio, row: T(giorno_inizio) I think it's a problem about the last version of web2py.. -- 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: bootstrap very bad
Il giorno lunedì 12 marzo 2018 20:04:57 UTC+1, Andrea Fae' ha scritto: > > Hello, Why I have very bad format in the dialog and in the forms? label is > not on the lef of the field and all is white colourhow to change? Look > attached file... > response.formstyle = 'bootstrap4_inline' ?? response.form_label_separator = '' ?? where are in the docs? > thanks 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] bootstrap very bad
Hello, Why I have very bad format in the dialog and in the forms? label is not on the lef of the field and all is white colourhow to change? Look attached file... thanks 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. errore form.docx Description: MS-Word 2007 document
[web2py] Re: Issue with defaultdict(list)
Drew most likely what's happening is a variation of this g = defaultdict(list) g['foo'] = {'id': 1} # this could be any dictionary g['foo'].append('someValue') AttributeError: 'dict' object has no attribute 'append' Note that defaultdict only gives you the default if the key doesn't have a value already . -- 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: Issue with defaultdict(list)
I think I've narrowed it down to having an error somewhere in my 'students' controller. 1. If I remove all other functions within that controller, it works. 2. If I create a new controller and only have that function, it works. 3. If I put the same exact code in another existing controller, it works. I will have do some more testing to figure out where my actual problem lies.Will report back with any results. -- 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: Issue with defaultdict(list)
I am running from source, but still seem to have the issue. On Monday, March 12, 2018 at 1:55:51 AM UTC-4, Val K wrote: > > Hi! > If you're Windows user it's requires to run web2py from source (not > web2py.exe) to get modules that are installed on your machine I was doing some testing and it seems to work perfectly fine when I run it from default.py. However, any time I try to run it from the controller I need it in, it doesn't work. I even created the "test" function that worked for you, and I still get the "AttributeError: 'dict' object has no attribute 'append'". This one has really got me scratching my head. On Monday, March 12, 2018 at 7:14:59 AM UTC-4, Leonel Câmara wrote: > > This controller worked fine for me: > > def test(): > from collections import defaultdict > g = defaultdict(list) > g['somekey'].append('somevalue') > return response.json(g) > > > > You probably have a bug in your view. You can show us the code if you want. > -- 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: prevent multiple session at the same time
On Monday, March 12, 2018 at 7:23:26 AM UTC-4, Manuele wrote: > > Il 07/03/18 15:51, Anthony ha scritto: > > Be aware, that will require a database select on every request. If you > > want to minimize the database hits, you could also store in the > > session the time of the last database lookup, and then only check the > > database every X minutes (the tradeoff being that it could take up to > > X minutes to disable the first session after the second session has > > begun -- if you must ensure zero overlap of sessions, then you'll have > > to do the database check on every request). > > What if I cache on disk the result of a function that returns the > session id and I check if it corresponds to the real value? Not sure what you mean. Where does the session ID produced by the function come from, and how is the "real value" defined? What are you suggesting different from Massimo's approach. 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.
Re: [web2py] Re: prevent multiple session at the same time
Il 07/03/18 15:51, Anthony ha scritto: > Be aware, that will require a database select on every request. If you > want to minimize the database hits, you could also store in the > session the time of the last database lookup, and then only check the > database every X minutes (the tradeoff being that it could take up to > X minutes to disable the first session after the second session has > begun -- if you must ensure zero overlap of sessions, then you'll have > to do the database check on every request). What if I cache on disk the result of a function that returns the session id and I check if it corresponds to the real value? In this case how can I force to logout all other user logged in with the same username? I would prefer to give precedence to the last one who login. Cheers Manuele -- 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: Issue with defaultdict(list)
This controller worked fine for me: def test(): from collections import defaultdict g = defaultdict(list) g['somekey'].append('somevalue') return response.json(g) You probably have a bug in your view. You can show us the code if you want. -- 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: Unexpected behaviour executing a query with DAL and record versioning enabled
Hello Leonel, thanks for analyzing. Will open issue today. Andreas Am Freitag, 9. März 2018 16:55:12 UTC+1 schrieb Leonel Câmara: > > This is definitely a bug, the solution doesn't seem easy, The problem is > that it should not apply the common filters on the alias used on the left > join again as they are already applied on the left join ON query itself. > > Please file an issue here: > https://github.com/web2py/pydal/issues > -- 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.