Bugs item #1378359, was opened at 2005-12-11 14:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1378359&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: SQLObject from repository
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Col does not call object's __init__()?
Initial Comment:
I'm using ver 0.7 (downloaded it from SourceForge, I think)
I've had problems creating subclasses of StringCol (my
goal is to make the columns able to return GUI
components based on their type). My class definitions
look like this:
class NewChild(StringCol, SomeGUIMixIn):
def __init__(...):
super(NewChild, self).__init__(...)
The problem is: The constructor of SomeGUIMixIn (and
its superclasses) are never called by this statement.
I've searched the web looking for similar problems, and
it seems that this is related to the way super() works
with multiple inheritance. In my class declaration, it
wold start by calling the constructor of the leftmost
superclass (i.e. StringCol), go down it's entire
inheritance tree to object, and then proceed to the
next superclass in the definition (in this example
SomeGUIMixIn) and go down that tree to object. The
problem occurs if some superclass forgets to call the
one of it's own superclass's constructors. Then the
chain is broken, and no more constructors will be called.
It seems to me that this is the problem here. I checked
the source code availible via the API, and Col, a
direct subclass of object, never seems to call
object.__init__() (or the equivalent "super(Col,
self).__init__()"). This should be easy to fix? (my
suspicion is strengthened by the fact that if I reverse
the order of the superclasses of NewChild in it's
declaration to "class NewChild(SomeGUIMixIn,
StringCol)", at least my constructor in SomeGUIMixIn
and it's superclasses are called.
Please correct me if I'm wrong! I'm not experienced
with Python.
Best regards,
Jostein Bø Fløystad
lil...@gm...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1378359&group_id=74338
|