Commit c4e13290 authored by sylvain.thenault@logilab.fr's avatar sylvain.thenault@logilab.fr
Browse files

kill id_registerer

--HG--
branch : tls-sprint
parent 83228d379cbe
......@@ -97,28 +97,6 @@ class accepts_registerer(priority_registerer):
return False
class id_registerer(priority_registerer):
"""register according to the "id" attribute of the wrapped class,
refering to an entity type.
* if the type is not Any and is not defined the application'schema,
skip the wrapped class
* if an object previously registered has the same .id attribute,
kick it out
* register
"""
def do_it_yourself(self, registered):
etype = self.vobject.id
if etype != 'Any' and not self.schema.has_entity(etype):
self.skip()
return
self.remove_equivalents(registered)
return self.vobject
def equivalent(self, other):
return other.id == self.vobject.id
__all__ = [cls.__name__ for cls in globals().values()
if isinstance(cls, type) and issubclass(cls, registerer)
and not cls is registerer]
......@@ -87,6 +87,8 @@ class CubicWebRegistry(VRegistry):
self.register(obj, **kwargs)
def register(self, obj, **kwargs):
if kwargs.get('registryname', obj.__registry__) == 'etypes':
kwargs['clear'] = True
super(CubicWebRegistry, self).register(obj, **kwargs)
# XXX bw compat
ifaces = getattr(obj, 'accepts_interfaces', None)
......
......@@ -18,7 +18,6 @@ from cubicweb.rset import ResultSet
from cubicweb.selectors import yes
from cubicweb.appobject import AppRsetObject
from cubicweb.schema import RQLVocabularyConstraint, RQLConstraint, bw_normalize_etype
from cubicweb.common.registerers import id_registerer
try:
from cubicweb.common.uilib import printable_value, soup2xhtml
......@@ -222,8 +221,7 @@ class Entity(AppRsetObject, dict):
"""
__metaclass__ = metaentity
__registry__ = 'etypes'
__registerer__ = id_registerer
__selectors__ = (yes,)
__select__ = yes()
widgets = {}
id = None
e_schema = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment