Hello, I am trying to use magic attributes at the time of object creation.
Unfortunately self.id is not available until after the object is created. Attempting to set a magic attribute at creation time results in the exception: AttributeError: 'Resource' object has no attribute 'id' (with attribute 'details') I am using the latest SQLObject code from subversion (SQLObject-0.11dev_r3720). Test code: ################################################## from sqlobject import * sqlhub.processConnection = connectionForURI('postgres://t...@localhost/test') class Resource(SQLObject): name = StringCol() def _set_details(self, value): print "My id is %d" % self.id Resource.dropTable(ifExists=True) Resource.createTable() # Works. #a = Resource(name = 'test1') #a.details = 'fruit' # Does NOT work. b = Resource(name = 'test2', details = 'chair') ################################################## Regards, Emmanuel ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss