[vreg] we do want the opposite... stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 31 Mar 2010 12:22:20 +0200
branchstable
changeset 5103 2b242604fc42
parent 5102 04c84959cd85
child 5104 7aab5286f037
[vreg] we do want the opposite...
server/test/unittest_repository.py
vregistry.py
--- a/server/test/unittest_repository.py	Wed Mar 31 12:26:07 2010 +0200
+++ b/server/test/unittest_repository.py	Wed Mar 31 12:22:20 2010 +0200
@@ -484,7 +484,6 @@
     """
     def setUp(self):
         CubicWebTC.setUp(self)
-        self.hm = self.repo.hm
         CALLED[:] = ()
 
     def _after_relation_hook(self, pool, fromeid, rtype, toeid):
@@ -500,7 +499,7 @@
             def __call__(self):
                 CALLED.append((self.event, self.eidfrom, self.rtype, self.eidto))
 
-        self.hm.register(EcritParHook)
+        self.vreg.register(EcritParHook)
         eidp = self.execute('INSERT Personne X: X nom "toto"')[0][0]
         eidn = self.execute('INSERT Note X: X type "T"')[0][0]
         self.execute('SET N ecrit_par Y WHERE N type "T", Y nom "toto"')
--- a/vregistry.py	Wed Mar 31 12:26:07 2010 +0200
+++ b/vregistry.py	Wed Mar 31 12:22:20 2010 +0200
@@ -222,15 +222,13 @@
                                      % (args, kwargs.keys(),
                                         [repr(v) for v in appobjects]))
         if len(winners) > 1:
-            # don't we want the opposite: log in production environement, error
-            # while debugging?
+            # log in production environement, error while debugging
             if self.config.debugmode:
-                self.error('select ambiguity, args: %s\nkwargs: %s %s',
-                           args, kwargs.keys(), [repr(v) for v in winners])
-            else:
                 raise Exception('select ambiguity, args: %s\nkwargs: %s %s'
                                 % (args, kwargs.keys(),
                                    [repr(v) for v in winners]))
+            self.error('select ambiguity, args: %s\nkwargs: %s %s',
+                       args, kwargs.keys(), [repr(v) for v in winners])
         # return the result of calling the appobject
         return winners[0](*args, **kwargs)