Hi,
Is this a bug? I'd like to use the form:
print student.contactID
instead of :
print student.contact.id
cause I suspect its better optimized.
Thanks
-----------------------------code snip-------------
from sqlobject import *
from sqlobject.inheritance import InheritableSQLObject
connectString = 'postgres://myuser:[EMAIL PROTECTED]/mydb'
connection = connectionForURI(connectString)
sqlhub.threadConnection = connection
class Contact(SQLObject):
number = StringCol()
class Role1(InheritableSQLObject):
department = StringCol()
contact = ForeignKey('Contact', notNone=True)
class Student(Role1):
year = IntCol()
Student.dropTable(ifExists=True)
Role1.dropTable(ifExists=True)
Contact.dropTable(ifExists=True)
Contact.createTable()
Role1.createTable()
Student.createTable()
contact = Contact(number="555-90210")
student = Student(department="physics", year=1, contact=contact)
print student.contact
print student.contact.id
print student.contactID
-----------------------------code snip-------------
That produces this issue:
-----------------------------result snip-------------
<Contact 1L number='555-90210'>
Traceback (most recent call last):
File "sqlobjectInheritance.py", line 32, in ?
print student.contactID
File "<string>", line 1, in <lambda>
File "/usr/lib/python2.4/site-packages/sqlobject/main.py", line 984,
in _SO_loadValue
result = getattr(self, attrName)
AttributeError: 'Student' object has no attribute '_SO_val_contactID'
-----------------------------result snip-------------
I reproduced the fact with both these versions of sqlobject:
sqlobject 0.7.0
and
sqlobject 0.7.1b1
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss