Oops. Looks like I forgot the @classmethod decorator in this case, whereas I did it right on FileDBSequence and XMLRPCSequence. Titus, do you see a particular benefit to moving the _init_subclass out of the class definition as you did, over just using the @classmethod decorator? I only used the former pattern for SQLRow because there were multiple classes that could use the same _init_subclass function...
What this really highlights for me is the need to add SQL sequence tests to the test suite. It's utterly idiotic that I didn't catch this at the moment that I made these code changes. -- Chris On Sep 25, 2008, at 10:48 PM, C. Titus Brown wrote: > > Hey Rob, > > thanks for the script. I could duplicate the problem with your > script, > and it seems like a bug in pygr; the following patch to seqdb fixes it > for me: > > index 6c27b81..c047a49 100644 > --- a/pygr/seqdb.py > +++ b/pygr/seqdb.py > @@ -7,11 +7,13 @@ import classutil > import UserDict > import weakref > > +def sql_sequence_init_subclass(cls, db, **kwargs): > + db.seqInfoDict = db # db will act as its own seqInfoDict > + SQLRow._init_subclass(db=db, **kwargs) > + > class SQLSequence(SQLRow,SequenceBase): > "Transparent access to a DB row representing a sequence; no > caching." > - def _init_subclass(cls, db, **kwargs): > - db.seqInfoDict = db # db will act as its own seqInfoDict > - SQLRow._init_subclass(db=db, **kwargs) > + _init_subclass = classmethod(sql_sequence_init_subclass) > def __init__(self, id): > SQLRow.__init__(self, id) > SequenceBase.__init__(self) > > -- > > Basically _init_subclass *has* to be a classmethod; it is in SQLRow, > but > it's not defined as such on SQLSequence. This patch fixes that. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---
