3.5 api update
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 08 Dec 2009 17:48:26 +0100
changeset 4049 5838a4b0766d
parent 4048 12c4f7e2bed6
child 4050 f2e1bb4b7536
3.5 api update
entity.py
sobjects/test/unittest_supervising.py
--- a/entity.py	Tue Dec 08 17:48:06 2009 +0100
+++ b/entity.py	Tue Dec 08 17:48:26 2009 +0100
@@ -176,7 +176,7 @@
                 # that case the relation may still be missing. As we miss this
                 # later information here, systematically add it.
                 restrictions[-1] += '?'
-                # XXX user.req.vreg iiiirk
+                # XXX user._cw.vreg iiiirk
                 destcls = user._cw.vreg['etypes'].etype_class(desttype)
                 destcls._fetch_restrictions(var, varmaker, destcls.fetch_attrs,
                                             selection, orderby, restrictions,
@@ -795,9 +795,9 @@
         relations of the given type from or to this object should be deleted).
         """
         if _cw_unsafe:
-            execute = self.req.unsafe_execute
+            execute = self._cw.unsafe_execute
         else:
-            execute = self.req.execute
+            execute = self._cw.execute
         # XXX update cache
         for attr, values in kwargs.iteritems():
             if attr.startswith('reverse_'):
--- a/sobjects/test/unittest_supervising.py	Tue Dec 08 17:48:06 2009 +0100
+++ b/sobjects/test/unittest_supervising.py	Tue Dec 08 17:48:26 2009 +0100
@@ -17,10 +17,11 @@
 class SupervisingTC(CubicWebTC):
 
     def setup_database(self):
-        self.add_entity('Card', title=u"une news !", content=u"cubicweb c'est beau")
-        self.add_entity('Card', title=u"une autre news !", content=u"cubicweb c'est beau")
-        self.add_entity('Bookmark', title=u"un signet !", path=u"view?vid=index")
-        self.add_entity('Comment', content=u"Yo !")
+        req = self.request()
+        req.create_entity('Card', title=u"une news !", content=u"cubicweb c'est beau")
+        req.create_entity('Card', title=u"une autre news !", content=u"cubicweb c'est beau")
+        req.create_entity('Bookmark', title=u"un signet !", path=u"view?vid=index")
+        req.create_entity('Comment', content=u"Yo !")
         self.execute('SET C comments B WHERE B title "une autre news !", C content "Yo !"')
         self.vreg.config.global_set_option('supervising-addrs', 'test@logilab.fr')