Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-05-15 Thread Thadeus Burgess
More DAL testing... It is interesting, in that the first time the dal.py code is executed everything works just fine, however on the very next request I receive this trackback. http://paste.pocoo.org/show/214476/ sql.py works just fine for many requests. I am obviously using the dal in an envir

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-10 Thread mdipierro
First of all thank you for your through tests into the DAL. I worked into this specific issue and I fixed the discrepancy. It deserves an explanation anyway. Here is a minimal example to reproduce the problem: code db.define_table('b', Field('b')) db.define_table('c', Field('d')) print db()

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-09 Thread mdipierro
will look into this. On Apr 9, 2:14 pm, Thadeus Burgess wrote: > I do give it a name. >  In this case the name is 'current_R'. > > I just typed the line of code that caused the error to help you narrow > it down, I am sorry I did not copy/paste instead of quickly typing it. > The code is correct,

Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-09 Thread Thadeus Burgess
I do give it a name. In this case the name is 'current_R'. I just typed the line of code that caused the error to help you narrow it down, I am sorry I did not copy/paste instead of quickly typing it. The code is correct, I don't edit anything when I test it on dal.py By the way, the trackback s

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-09 Thread mdipierro
This >db.table.field.sum().with_alias() is invalid syntax. You need to give it a name db.table.field.sum().with_alias('thesum') On Apr 9, 1:43 pm, Thadeus Burgess wrote: > db.table.field.sum().with_alias() > > Traceback (most recent call last): >   File "/home/tburgess/Applications/web2py/gluo

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-09 Thread Thadeus Burgess
db.table.field.sum().with_alias() Traceback (most recent call last): File "/home/tburgess/Applications/web2py/gluon/restricted.py", line 173, in restricted exec ccode in environment File "/home/tburgess/Applications/web2py/applications/pms/controllers/default.py", line 305, in File "/h

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-08 Thread Thadeus Burgess
Agreed. Lets narrow this down, I will see if I can replicate the issue on a smaller scale. -Thadeus On Wed, Apr 7, 2010 at 11:08 PM, Massimo Di Pierro wrote: > I guess my question is " why does it not throw an exception in sql.py?" It > should since > >>> db.dog.owner.represent = lambda valu

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Massimo Di Pierro
I guess my question is " why does it not throw an exception in sql.py?" It should since db.dog.owner.represent = lambda value: "%s" % db.person[value].name when called with value==None should always result in the error you see in dal.py. Can you help me debug this? My problem is not why

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Thadeus Burgess
I am not using different datasets, or using different queries. So here we go, let me explain in every minuet detail this process. >>> cd ~ >>> hg clone https://web2py.googlecode.com/hg web2py >>> cd web2py >>> ln -s ~/path/to/my/application applications/pms >>> python web2py.py -a *go to 127.0.0

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Massimo Di Pierro
I assume it is db.dog.owner.represent = lambda value: "%s" % db.person[value].name The stacktrace you get is because one of your records has owner==None hence db.person[value] is also None and None has no .name. It is not a bug. You are doing different queries or using different datasets.

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Thadeus Burgess
I am defining this function. db.define_table('person', Field('name')) db.define_table('dog', Field('nickname'), Field('owner', db.person)) db.dog.owner.represent = lambda value: "%s" % db.owner[value].name This works in sql.py This does not work in dal.py You said you made changes, I tested, w

Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Thadeus Burgess
No. For dal.py to be accepted it has to work exactly like sql.py Therefore I cannot make ANY code changes if we want a new DAL. -Thadeus On Wed, Apr 7, 2010 at 5:31 PM, mdipierro wrote: > This > >    db.TableA.id_TableB.represent = lambda value: "%s" % > db.TableB[value].name > > should be

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread mdipierro
This db.TableA.id_TableB.represent = lambda value: "%s" % db.TableB[value].name should be db.TableA.id_TableB.represent = lambda value: (db.TableB[value] or {}).get('name','anonymous') On Apr 7, 1:36 pm, Thadeus Burgess wrote: > Traceback (most recent call last): >   File "/home/tburge

Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Thadeus Burgess
It comes from the line db.TableB[value].name -Thadeus On Wed, Apr 7, 2010 at 3:19 PM, mdipierro wrote: > need more info > > On Apr 7, 1:36 pm, Thadeus Burgess wrote: >> Traceback (most recent call last): >>   File "/home/tburgess/Applications/web2py/gluon/restricted.py", line >> 173, in r

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread mdipierro
need more info On Apr 7, 1:36 pm, Thadeus Burgess wrote: > Traceback (most recent call last): >   File "/home/tburgess/Applications/web2py/gluon/restricted.py", line > 173, in restricted >     exec ccode in environment >   File > "/home/tburgess/Applications/web2py/applications/pms/views/default

Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-07 Thread Thadeus Burgess
Traceback (most recent call last): File "/home/tburgess/Applications/web2py/gluon/restricted.py", line 173, in restricted exec ccode in environment File "/home/tburgess/Applications/web2py/applications/pms/views/default/index.html", line 62, in File "/home/tburgess/Applications/web

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-05 Thread mdipierro
uploading fix. please check it. Thanks for testing this. On Apr 5, 3:59 pm, Thadeus Burgess wrote: > Traceback (most recent call last): >   File "/home/tburgess/Applications/web2py/gluon/restricted.py", line > 173, in restricted >     exec ccode in environment >   File > "/home/tburgess/Applicat

Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-05 Thread Thadeus Burgess
Traceback (most recent call last): File "/home/tburgess/Applications/web2py/gluon/restricted.py", line 173, in restricted exec ccode in environment File "/home/tburgess/Applications/web2py/applications/pms/controllers/default.py", line 278, in File "/home/tburgess/Applications/web2py/gl

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-05 Thread mdipierro
try now On Apr 5, 2:30 pm, Thadeus Burgess wrote: > Now I get this for reference field > > Traceback (most recent call last): >   File "/home/tburgess/Applications/web2py/gluon/restricted.py", line > 173, in restricted >     exec ccode in environment >   File > "/home/tburgess/Applications/web2p

Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-05 Thread Thadeus Burgess
Now I get this for reference field Traceback (most recent call last): File "/home/tburgess/Applications/web2py/gluon/restricted.py", line 173, in restricted exec ccode in environment File "/home/tburgess/Applications/web2py/applications/pms/views/default/index.html", line 84, in {{=d

[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename

2010-04-05 Thread mdipierro
I fixed the former. I did not fix the latter. It is a known problem with the new dal and one of the few things that needs to be ironed out: it does not like select('fieldname') only select(db.table['fieldname']). Not difficult to fix anyway. On Apr 5, 2:13 pm, Thadeus Burgess wrote: > I get this