Compute the correct package name for hierarchies that change class names
This commit is contained in:
parent
116f6b30eb
commit
87c87ff767
@ -306,6 +306,10 @@ def _flush_callbacks(check_name):
|
|||||||
_flush_callbacks('run_before')
|
_flush_callbacks('run_before')
|
||||||
_flush_callbacks('run_after')
|
_flush_callbacks('run_after')
|
||||||
|
|
||||||
|
# Reset names for packages that inherit from another
|
||||||
|
# package with a different name
|
||||||
|
attr_dict['_name'] = None
|
||||||
|
|
||||||
return super(PackageMeta, cls).__new__(cls, name, bases, attr_dict)
|
return super(PackageMeta, cls).__new__(cls, name, bases, attr_dict)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -355,7 +359,7 @@ def name(self):
|
|||||||
The name of a package is the name of its Python module, without
|
The name of a package is the name of its Python module, without
|
||||||
the containing module names.
|
the containing module names.
|
||||||
"""
|
"""
|
||||||
if not hasattr(self, '_name'):
|
if self._name is None:
|
||||||
self._name = self.module.__name__
|
self._name = self.module.__name__
|
||||||
if '.' in self._name:
|
if '.' in self._name:
|
||||||
self._name = self._name[self._name.rindex('.') + 1:]
|
self._name = self._name[self._name.rindex('.') + 1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user