-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'DAL' object has no attribute #1266
Comments
Shouldn't parent be "reference page", not integer, and not have a default value at all? Anyway it does seem like a DAL bug since page is indeed defined. |
same here! My exact error: my relevant db.py sections: db = DAL('mysql://user:password@192.168.1.111/dbname', pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['mysql'],lazy_tables = True,
db.define_table('sedi',
Field('name', length=100, requires=IS_NOT_EMPTY()),
Field('dominio', 'reference domini', writable=False, readable=False, default=lambda:session.domain ),
Field('dipartimento', 'reference dipartimenti'),
Field('trunk', 'reference trunks', ondelete='SET NULL', requires=IS_EMPTY_OR(IS_IN_DB(db, 'trunks.id','%(id)s - %(name)s'))),
format='%(name)s',
common_filter = lambda query: db.sedi.dominio==session.domain,
)
db.define_table('trunks',
Field('dominio', 'reference domini', writable=False, readable=False, default=lambda:session.domain ),
Field('name', length = 100, requires=IS_NOT_EMPTY()),
Field('enabled', 'boolean', default = False),
format='%(name)s',
common_filter = lambda query: db.trunks.dominio == session.domain,
) |
Tried to isolate the problematic file. |
trunks should maybe come before sedi?? On Tue, Apr 12, 2016 at 9:04 AM, Marvi notifications@github.com wrote:
|
In this simple case would resolve the problem. But the complete application has many other tables and relations in a way that at least one relation must come before the table that refers to. |
Yes apparently IS_IN_DB stopped being lazy when evaluating the field. I'm looking at it, this issue is very easy to reproduce. Just put this pretty commonly used table in your db.py
|
I think it can come from 2.13.4, I remember having noticed something On Wed, Apr 13, 2016 at 7:41 PM, Leonel Câmara notifications@github.com
|
I have a fix for it, let me just add a test for it to make sure it doesn't happen again. |
fixes #1266 and adds tests to make sure it doesn't happen again
Hello,
web2py: Version 2.14.3-stable+timestamp.2016.03.26.23.02.02
dal: 16.03
I've just updated to the last version and received the bug:
(previous version worked fine)
Table - page
Field('name', notnull=True),
Field('parent', 'integer', default=0, requires=IS_EMPTY_OR(IS_IN_DB(self.db, 'page.id', '%(name)s')),
AttributeError: 'DAL' object has no attribute 'page'
The text was updated successfully, but these errors were encountered: