--- a/common/registerers.py Tue Feb 17 23:08:21 2009 +0100
+++ b/common/registerers.py Tue Feb 17 23:09:31 2009 +0100
@@ -97,28 +97,6 @@
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]
--- a/cwvreg.py Tue Feb 17 23:08:21 2009 +0100
+++ b/cwvreg.py Tue Feb 17 23:09:31 2009 +0100
@@ -87,6 +87,8 @@
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)
--- a/entity.py Tue Feb 17 23:08:21 2009 +0100
+++ b/entity.py Tue Feb 17 23:09:31 2009 +0100
@@ -18,7 +18,6 @@
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 @@
"""
__metaclass__ = metaentity
__registry__ = 'etypes'
- __registerer__ = id_registerer
- __selectors__ = (yes,)
+ __select__ = yes()
widgets = {}
id = None
e_schema = None