Hello,
I have encountered a situation where I'd like to define a common
subclass (in the sense of Python) for a set of closely related and quite
bulky SQLObject classes. Actually, at least now, these classes differ
only by sqlmeta.table, but in the future this might change. Now, a vital
part of the class structure specification is that each table has the
same primary key name. Thus, it would be nice to have the id name
declared inside the class scope, not in the sqlmeta, like this:
class A(SQLObject):
_idName = "Ident"
# a lot of other definitions: fields, instance and class methods
class A1(A):
class sqlmeta: table="TableA1"
pass # possibly something more elaborate some day
class A2(A):
class sqlmeta: table="TableA2"
pass # possibly something more elaborate some day
This of course does not quite work on SQLObject 0.7.1 and 0.7.2 (I
suppose used to work in the more remote past?). There are two problems
here: the _idName gets erased in subclasses defining sqlmeta, and (a
minor wart) _idName is deprecated so the code spits a warning. I believe
the situation described above is a legitimate reason to undeprecate
_idName and make it work with subclasses defining sqlmeta - this would
probably require checking if id name is defined in both places and
throwing an error on this or somethinig. If you like the idea, I may be
able to send a patch in a few days.
Robert
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss