--- a/cwvreg.py Mon May 25 16:09:34 2009 +0200
+++ b/cwvreg.py Mon May 25 16:10:52 2009 +0200
@@ -11,7 +11,7 @@
from rql import RQLHelper
-from cubicweb import Binary, UnknownProperty, UnknownEid
+from cubicweb import ETYPE_NAME_MAP, Binary, UnknownProperty, UnknownEid
from cubicweb.vregistry import VRegistry, ObjectNotFound, NoSelectableObject
from cubicweb.rtags import RTAGS
@@ -170,7 +170,10 @@
# browse ancestors from most specific to most generic and
# try to find an associated custom entity class
for baseschema in baseschemas:
- btype = str(baseschema)
+ try:
+ btype = ETYPE_NAME_MAP[baseschema]
+ except KeyError:
+ btype = str(baseschema)
try:
cls = self.select(self.registry_objects('etypes', btype), etype)
break
@@ -387,7 +390,14 @@
vobject.vreg = self
vobject.schema = self.schema
vobject.config = self.config
- return super(MulCnxCubicWebRegistry, self).select(vobjects, *args, **kwargs)
+ selected = super(MulCnxCubicWebRegistry, self).select(vobjects, *args,
+ **kwargs)
+ # redo the same thing on the instance so it won't use equivalent class
+ # attributes (which may change)
+ selected.vreg = self
+ selected.schema = self.schema
+ selected.config = self.config
+ return selected
from datetime import datetime, date, time, timedelta