From 479a5ef0abb5f1c943c44cb110d3dfaeb77b720c Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Wed, 15 Jul 2009 14:47:57 -0700 Subject: [PATCH] moved dbname default into get_bound_subclass() --- pygr/classutil.py | 5 ++++- pygr/seqdb.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pygr/classutil.py b/pygr/classutil.py index e10fa1f..3504193 100644 --- a/pygr/classutil.py +++ b/pygr/classutil.py @@ -346,7 +346,10 @@ def get_bound_subclass(obj, classattr='__class__', subname=None, factories=(), else: # someone else's shadow class, so shadow its parent targetClass = targetClass._shadowParent if subname is None: # get a name from worldbase ID - subname = obj._persistent_id.split('.')[-1] + try: + subname = obj._persistent_id.split('.')[-1] + except AttributeError: + subname = '__generic__' class shadowClass(targetClass): __reduce__ = shadow_reducer _shadowParent = targetClass # NEED TO KNOW ORIGINAL CLASS diff --git a/pygr/seqdb.py b/pygr/seqdb.py index 5762646..084feb4 100644 --- a/pygr/seqdb.py +++ b/pygr/seqdb.py @@ -204,7 +204,7 @@ class SequenceDB(object, UserDict.DictMixin): # define ~ (invert) operator to return a lazily-created _SequenceDBInverse __invert__ = classutil.lazy_create_invert(_SequenceDBInverse) - def __init__(self, autoGC=True, dbname='__generic__', **kwargs): + def __init__(self, autoGC=True, dbname=None, **kwargs): """Initialize seq db from filepath or ifile.""" if autoGC: # automatically garbage collect unused objects self._weakValueDict = classutil.RecentValueDictionary(autoGC) -- 2.11.4.GIT