def load(self): """Load the module for this plugin. @rtype: C{ModuleType} @return: The module object that is loaded. """ return namedModule(self.module)
def latestClass(oldClass): """Get the latest version of a class. """ module = reflect.namedModule(oldClass.__module__) newClass = getattr(module, oldClass.__name__) newBases = [] for base in newClass.__bases__: newBases.append(latestClass(base)) try: newClass.__bases__ = tuple(newBases) return newClass except TypeError: ctor = getattr(newClass, '__metaclass__', type) return ctor(newClass.__name__, tuple(newBases), dict(newClass.__dict__))
def latestClass(oldClass): """Get the latest version of a class. """ module = reflect.namedModule(oldClass.__module__) newClass = getattr(module, oldClass.__name__) newBases = [] for base in newClass.__bases__: newBases.append(latestClass(base)) try: # This makes old-style stuff work newClass.__bases__ = tuple(newBases) return newClass except TypeError: ctor = getattr(newClass, '__metaclass__', type) return ctor(newClass.__name__, tuple(newBases), dict(newClass.__dict__))