Little trouble with the Version 2.6.0-dev....2013.07.28.05.46.47 table hasn't a name field

34 views
Skip to first unread message

szimszon

unread,
Jul 29, 2013, 8:44:00 AM7/29/13
to web2py-d...@googlegroups.com
Hi!

I wonder if somebody could help me!

I have a little trouble with the last dev version:

Traceback (most recent call last):
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/restricted.py", line 212, in restricted
    exec ccode in environment
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/applications/web2print/models/db.py", line 1556, in <module>
    cache=(cache.disk, 600)).first()
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 9963, in select
    return adapter.select(self.query,fields,attributes)
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 1724, in select
    sql = self._select(query, fields, attributes)
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 1633, in _select
    query = self.common_filter(query,tablenames_for_common_filters)
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 2162, in common_filter
    query = query & table._common_filter(query)
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 8354, in <lambda>
    if tn==t.name or getattr(db[tn],'_ot',None)==t.name])
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 8427, in __getitem__
    return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute 'name'

I have no name field in the db table but after the

https://github.com/web2py/web2py/commit/60d0812f774bfc94ef20542bc0b1fbe0bcae66e2

(fixed issue 1596:Alias don't work with record versioning)

commit 7 days ago, it is checked for t.name:

        if is_active and is_active in fieldnames:
            self._before_delete.append(
                lambda qset: qset.update(is_active=False))
-           newquery = lambda query, t=self: t.is_active == True
+           newquery = lambda query, t=self: \
+               reduce(AND,[db[tn].is_active == True
+                           for tn in db._adapter.tables(query)
+                           if tn==t.name or getattr(db[tn],'_ot',None)==t.name])
            query = self._common_filter
            if query:
                newquery = query & newquery
            self._common_filter = newquery

I do not understand fully the logic so I can't provide a patch but could be simple. Please somebody take a look.

Thanks.

Issue: http://code.google.com/p/web2py/issues/detail?id=1609

Massimo DiPierro

unread,
Jul 29, 2013, 8:50:52 AM7/29/13
to web2py-d...@googlegroups.com
Thanks. This helps a lot. It should now be fixed. Please check it.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

szimszon

unread,
Jul 29, 2013, 9:02:24 AM7/29/13
to web2py-d...@googlegroups.com
It works now thanks.
Reply all
Reply to author
Forward
0 new messages