--- a/__pkginfo__.py Mon May 25 16:43:50 2009 +0200
+++ b/__pkginfo__.py Mon May 25 16:43:57 2009 +0200
@@ -6,7 +6,7 @@
distname = "cubicweb"
modname = "cubicweb"
-numversion = (3, 2, 0)
+numversion = (3, 2, 1)
version = '.'.join(str(num) for num in numversion)
license = 'LGPL v2'
--- a/cwvreg.py Mon May 25 16:43:50 2009 +0200
+++ b/cwvreg.py Mon May 25 16:43:57 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
@@ -372,6 +375,8 @@
default to a dump of the class registered for 'Any'
"""
usercls = super(MulCnxCubicWebRegistry, self).etype_class(etype)
+ if etype == 'Any':
+ return usercls
usercls.e_schema = self.schema.eschema(etype)
return usercls
@@ -385,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
--- a/dbapi.py Mon May 25 16:43:50 2009 +0200
+++ b/dbapi.py Mon May 25 16:43:57 2009 +0200
@@ -13,7 +13,8 @@
from logging import getLogger
from time import time, clock
-from cubicweb import ConnectionError, RequestSessionMixIn, set_log_methods
+from logilab.common.logging_ext import set_log_methods
+from cubicweb import ETYPE_NAME_MAP, ConnectionError, RequestSessionMixIn
from cubicweb.cwvreg import CubicWebRegistry, MulCnxCubicWebRegistry
from cubicweb.cwconfig import CubicWebNoAppConfiguration
@@ -101,7 +102,12 @@
vreg = MulCnxCubicWebRegistry(config, initlog=initlog)
else:
vreg = CubicWebRegistry(config, initlog=initlog)
- vreg.set_schema(repo.get_schema())
+ schema = repo.get_schema()
+ for oldetype, newetype in ETYPE_NAME_MAP.items():
+ if oldetype in schema:
+ print 'aliasing', newetype, 'to', oldetype
+ schema._entities[newetype] = schema._entities[oldetype]
+ vreg.set_schema(schema)
else:
vreg = None
cnx = repo_connect(repo, user, password, cnxprops)
@@ -325,11 +331,6 @@
self.vreg = None
# session's data
self.data = {}
- # XXX < 3.2 bw compat
- if 'EUser' in self._repo.get_schema():
- self._user_etype = 'EUser'
- else:
- self._user_etype = 'CWUser'
def __repr__(self):
if self.anonymous_connection:
@@ -435,9 +436,9 @@
eid, login, groups, properties = self._repo.user_info(self.sessionid, props)
if req is None:
req = self.request()
- rset = req.eid_rset(eid, self._user_etype)
- user = self.vreg.etype_class(self._user_etype)(req, rset, row=0, groups=groups,
- properties=properties)
+ rset = req.eid_rset(eid, 'CWUser')
+ user = self.vreg.etype_class('CWUser')(req, rset, row=0, groups=groups,
+ properties=properties)
user['login'] = login # cache login
return user
--- a/rset.py Mon May 25 16:43:50 2009 +0200
+++ b/rset.py Mon May 25 16:43:57 2009 +0200
@@ -380,9 +380,6 @@
pass
# build entity instance
etype = self.description[row][col]
- if etype == 'EUser':
- import traceback
- traceback.printstack()
entity = self.vreg.etype_class(etype)(req, self, row, col)
entity.set_eid(eid)
# cache entity