diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-01-11 12:07:10 +0100 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-01-11 12:07:10 +0100 |
commit | 942ef514462522c0ea250fbc402e5ae67fbeaf5e (patch) | |
tree | 3e6ef37bd6df0532df1ab9bf01a276cae1024d6d /registry.py | |
parent | 247b86271595f52cecfd4c998442f6e5c5ae7014 (diff) | |
download | logilab-common-942ef514462522c0ea250fbc402e5ae67fbeaf5e.tar.gz |
[registry]?deprecate usage of leading underscore to mark class as abstract / not to register
Diffstat (limited to 'registry.py')
-rw-r--r-- | registry.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/registry.py b/registry.py index 05b8b2e..7a4072c 100644 --- a/registry.py +++ b/registry.py @@ -670,8 +670,7 @@ class RegistryStore(dict): - first ensure parent classes are already registered - - class with __abstract__ == True in their local dictionary or - with a name starting with an underscore are not registered + - class with __abstract__ == True in their local dictionary are skipped - object class needs to have __registry__ and __regid__ attributes set to a non empty string to be registered. @@ -696,8 +695,13 @@ class RegistryStore(dict): self._loadedmods[modname][clsid] = objectcls for parent in objectcls.__bases__: self._load_ancestors_then_object(modname, parent) + if reg.objname(obj)[0] == '_': + warn("[lgc 0.59] object whose name start with '_' won't be " + "skipped anymore at some point, use __abstract__ = True " + "instead (%s)" % obj, DeprecationWarning) + return + if (objectcls.__dict__.get('__abstract__') - or objectcls.__name__[0] == '_' or not objectcls.__registries__ or not objectcls.__regid__): return |