Any problem in list:reference in 2.10 ?

123 views
Skip to first unread message

Ariya Owam-aram

unread,
Apr 28, 2015, 3:26:23 PM4/28/15
to web...@googlegroups.com
Hi Everyone,

I just upgrade to 2.10.4 and found error message when using filed list:reference.

APP : welcome 

DB
db.define_table('parent', Field('name'))
db.define_table('student', Field('name'), Field('parent', 'list:reference parent'))

in APPADMIN
- from parent table insert : father, mother
- from student table insert : student1 with select father (or mother or both)
- open student grid view : return error 

<type 'exceptions.TypeError'> isinstance() arg 2 must be a class, type, or tuple of classes and types

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/welcome/views/appadmin.html", line 175, in <module>
{{
if ram['bytes'] > 524287:}}
File "/home/www-data/web2py/gluon/sqlhtml.py", line 3253, in __init__
r = represent(field, r or [], record)
File "/home/www-data/web2py/gluon/sqlhtml.py", line 68, in represent
return f(value)
File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py", line 268, in __call__
if isinstance(db._adapter, GoogleDatastoreAdapter):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types

Frames

  • File /home/www-data/web2py/gluon/restricted.py in restricted at line 227 code arguments variables

  • File /home/www-data/web2py/applications/welcome/views/appadmin.html in <module> at line 175 code arguments variables

  • File /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 3253 code arguments variables

  • File /home/www-data/web2py/gluon/sqlhtml.py in represent at line 68 code arguments variables

  • File /home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py in __call__ at line 268 code arguments variables

    Function argument list

    (self=<pydal.helpers.methods._repr_ref_list object>, value=[1L], row=None)

    Code listing
    263.
    264.
    265.
    266.
    267.
    268.

    269.
    270.
    271.
    272.
            if not value:
    return None
    from
    ..adapters import GoogleDatastoreAdapter
    refs = None
    db, id = self.ref._db, self.ref._id
    if isinstance(db._adapter, GoogleDatastoreAdapter):

    def count(values):
    return db(id.belongs(values)).select(id)
    rx = range(0, len(value), 30)
    refs = reduce(lambda a, b: a & b, [count(value[i:i+30])
    Variables
    builtinisinstance<built-in function isinstance>
    db._adapter<pydal.adapters.sqlite.SQLiteAdapter object>
    db<DAL uri="sqlite://storage.sqlite">
    GoogleDatastoreAdapterNone

Thank you
Ariya

Paolo Valleri

unread,
Apr 29, 2015, 6:07:21 AM4/29/15
to web...@googlegroups.com

Ariya Owam-aram

unread,
May 4, 2015, 11:56:35 AM5/4/15
to web...@googlegroups.com
Thank you,

A



เมื่อ วันพุธที่ 29 เมษายน ค.ศ. 2015 17 นาฬิกา 07 นาที 21 วินาที UTC+7, Paolo Valleri เขียนว่า:

Ben Sharif

unread,
May 4, 2015, 11:56:36 AM5/4/15
to web...@googlegroups.com
Hi,

I was having this problem too (since 2.10.4), everything worked OK in 2.9.11.
Has exactly the same error as Ariya above. 
Running on pythonanywhere I just tried your fix from github. 
In this file:
web2py > gluon > packages > dal > pydal > helpers > methods.py 
I replaced:
if isinstance(db._adapter, GoogleDatastoreAdapter):
with 
if db._adapter.dbengine == 'google:datastore':

The problem seems to be fixed as a result. 
Thanks!!

wish...@gmail.com

unread,
May 4, 2015, 11:56:36 AM5/4/15
to web...@googlegroups.com
Hi Paolo,

> Can you try to replace the failing line with if db._adapter.dbengine == 'google:datastore'
Solved the issue for me, only the colon at end of missing :-)

Thanks!
Toby

Ben Lawrence

unread,
May 7, 2015, 9:41:17 AM5/7/15
to web...@googlegroups.com
This fixes an error I experience in the db admin interface, when I use postgresql.
When i use sqlite, I did not see this error for the same code in my app.

Stefan van den Eertwegh

unread,
Aug 22, 2015, 7:58:26 PM8/22/15
to web2py-users
Massimo,

I have updated my web2py to 2.12.2 and still have this problem with a list:reference <table>
Is this something you still have to fix in the web2py version?

Greetings,
Stefan van den Eertwegh

Op dinsdag 28 april 2015 21:26:23 UTC+2 schreef Ariya Owam-aram:

Massimo Di Pierro

unread,
Aug 22, 2015, 8:19:31 PM8/22/15
to web2py-users
2.12.3 is out. Can you please check that?

Stefan van den Eertwegh

unread,
Aug 23, 2015, 7:46:57 AM8/23/15
to web2py-users
Thanks Massimo! Problem is solved in 2.12.3!

Op zondag 23 augustus 2015 02:19:31 UTC+2 schreef Massimo Di Pierro:
Reply all
Reply to author
Forward
0 new messages