Hello! I returned to investigate the issue and found it's more complex than I thought...
On Thu, Jun 11, 2009 at 10:11:27AM -0400, Joe Lanese wrote: > This issue seems to be caused by a change in SQLObject. > The change in behaviour seems to be due to a change made in SQLObject in > main.py, where the ?idName? attribute was taken out of a list of unshared > attributes. This caused the sqlmeta class to share the idName value with > its containing class, so they both end up with ?id? even when longID is set > to true in your own class. If you add it back in: > _unshared_attributes = ['table', 'columns', 'childName', 'idName'] > then it should work as before...however, I'm not sure if this will cause > other problems (so far it seems to work). > > By the way, here is a link to a change that seems to have triggered this > change in behaviour: > http://www.mail-archive.com/sqlobject-discuss@lists.sourceforge.net/msg02159.html In essence, the problem is in class sqlmeta, method setClass: if cls.idName is None: cls.idName = cls.style.idForTable(cls.table) The method poises the class so in any class inherited from sqlmeta idName will be already set and the test fails. Adding idName to the list of unshared attributes resets idName to None but that prevents proper inheritance of idName. To explain all this with code - with current SQLObject the following code class sqlmeta(sqlmeta): idName = 'ddd' class Test1(SQLObject): class sqlmeta(sqlmeta): style = MixedCaseStyle(longID=True) Test1.createTable() print Test1.sqlmeta.idName class Test2(SQLObject): class sqlmeta: style = MixedCaseStyle(longID=True) Test2.createTable() print Test2.sqlmeta.idName prints 'ddd' and 'id'; the first idName is right and the second one is wrong (it must be 'Test2ID'). The same code running with idName added to the list of unshared attributes prints 'Test1ID' and 'Test2ID'; the first one is wrong (it must be 'ddd') and the second one is right. Probably the correct way of fixing it is to add idName (and 'style' because setClass tests and sets it too) to the list of unshared attributes but make sqlmeta.__classinit__ to recognize inherited attributes and do not reset them. I will think of it... Oleg. -- Oleg Broytman http://phd.pp.ru/ p...@phd.pp.ru Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss