On Wed, 2006-12-20 at 10:25 +0100, Diez B. Roggisch wrote:
> I don't consider this a bug in the strict sense of the word - you are abusing 
> InheritableSQLObject. By inheriting from it, you make things essentially the 
> same kind, but all you really want is them all to respond to a common 
> interface. 

I want to be able to do this:
class Version(SQLObject):
        target = ForeignKey("Versionable")
        ...

This requires a bit more than having Versionables respond to a common
interface -- it requires a way to refer to a Versionable which might be
a Task or might be a TaskList.  I could do

target_id = ForeignKey("Task")
target_type_name = StringCol()

and then in Task and TaskList:
def versions(self):
        Version.selectBy(target_id = self.id, target_type_name =
str(self.__class__))

But this means that I am writing a bunch of code that inheritance is
supposed to do for me.  



-------------------------------------------------------------------------
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

Reply via email to