Silence cubicweb 3.16 deprecation warnings
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 24 Jul 2014 14:39:57 +0200
changeset 1561 ea7b1e630c1b
parent 1560 4205ad135a12
child 1565 7401cf73d1cc
Silence cubicweb 3.16 deprecation warnings set_attributes/set_relations became cw_set.
hooks.py
migration/1.2.0_Any.py
migration/2.0.0_Any.py
migration/2.2.1_Any.py
test/unittest_hooks.py
--- a/hooks.py	Thu Jul 24 12:10:47 2014 +0200
+++ b/hooks.py	Thu Jul 24 14:39:57 2014 +0200
@@ -77,14 +77,14 @@
         tc = self.tc
         if tc.start_mode == u'inherited':
             if tc.config_parent:
-                tc.set_attributes(computed_start_mode=tc.config_parent.computed_start_mode)
+                tc.cw_set(computed_start_mode=tc.config_parent.computed_start_mode)
                 self.update_refinements()
             else:
                 msg = self.session._('Inherited start mode can only be used if the '
                                      'configuration refines another one')
                 raise ValidationError(tc.eid, {'start_mode': msg})
         elif tc.computed_start_mode != tc.start_mode:
-            tc.set_attributes(computed_start_mode=tc.start_mode)
+            tc.cw_set(computed_start_mode=tc.start_mode)
             self.update_refinements()
 
     def update_refinements(self):
@@ -167,7 +167,7 @@
                 # dark cases we end up with several version information about the
                 # same project on the same check result...
                 if cri.check_result.eid not in done:
-                    cri.check_result.set_relations(using_revision=revision)
+                    cri.check_result.cw_set(using_revision=revision)
                     done.add(cri.check_result.eid)
                 cri.cw_delete()
 
@@ -308,7 +308,7 @@
         te = trinfo.for_entity
         if te.status == u'waiting execution':
             # this should only happen if error in recipe script
-            te.set_attributes(status=u'error')
+            te.cw_set(status=u'error')
         if te.status_changes():
             view = self._cw.vreg['views'].select(
                 'apycot.notif.exstchange', self._cw, rset=te.as_rset(),
--- a/migration/1.2.0_Any.py	Thu Jul 24 12:10:47 2014 +0200
+++ b/migration/1.2.0_Any.py	Thu Jul 24 14:39:57 2014 +0200
@@ -39,7 +39,7 @@
     cpp = testconfig.check_preprocessors
     newcpp = update_field(cpp)
     if newchecks != checks or newcpp != cpp:
-        testconfig.set_attributes(checks=newchecks, check_preprocessors=newcpp)
+        testconfig.cw_set(checks=newchecks, check_preprocessors=newcpp)
 checkpoint()
 
 # new expectation for vcs_branch / vcs_path ####################################
--- a/migration/2.0.0_Any.py	Thu Jul 24 12:10:47 2014 +0200
+++ b/migration/2.0.0_Any.py	Thu Jul 24 14:39:57 2014 +0200
@@ -31,7 +31,7 @@
         config += u'\nsubpath=%s' % tc.subpath
     if tc.checks:
         config += '\nXXXchecks=%s' % tc.checks
-    tc.set_attributes(check_config=config)
+    tc.cw_set(check_config=config)
 drop_attribute('TestConfig' , 'subpath')
 drop_attribute('TestConfig', 'checks')
 
@@ -59,7 +59,7 @@
             cfg = u'%s\n%s' % (pe.check_config, pe.check_preprocessors)
         else:
             cfg = pe.check_preprocessors
-        pe.set_attributes(check_config=cfg)
+        pe.cw_set(check_config=cfg)
 
 drop_attribute('ProjectEnvironment' , 'check_preprocessors')
 
@@ -88,7 +88,7 @@
         reporset = rql('Repository X WHERE X path %(repo)s OR X source_url %(repo)s',
                        {'repo': project.vcs_repository}, ask_confirm=False)
         if reporset:
-            project.set_relations(local_repository=reporset.get_entity(0, 0))
+            project.cw_set(local_repository=reporset.get_entity(0, 0))
         elif project.vcs_repository.startswith('/'):
             rql('INSERT Repository R: R type %(type)s, R path %(path)s, '
                 'P local_repository R WHERE P eid %(eid)s',
--- a/migration/2.2.1_Any.py	Thu Jul 24 12:10:47 2014 +0200
+++ b/migration/2.2.1_Any.py	Thu Jul 24 14:39:57 2014 +0200
@@ -1,6 +1,6 @@
 
 for step in rql('RecipeStep RS WHERE RS target %(target)s', {'target': u'apycot.get_dependancies'}).entities():
-    step.set_attributes(target=u'apycot.get_dependencies')
+    step.cw_set(target=u'apycot.get_dependencies')
 
 rql('DELETE Recipe R WHERE R name IN ("apycot.recipe.debian", "apycot.recipe.experimental")')
 
--- a/test/unittest_hooks.py	Thu Jul 24 12:10:47 2014 +0200
+++ b/test/unittest_hooks.py	Thu Jul 24 14:39:57 2014 +0200
@@ -187,7 +187,7 @@
     def test_new_vc_trigger(self):
         """ check the on new revision start mode. Run all testconfigs, add new
         revision, re-run and check there are new test configs"""
-        self.lgc.set_attributes(start_mode=u'on new revision')
+        self.lgc.cw_set(start_mode=u'on new revision')
         lgc2 = self.add_test_config(u'lgc2',
                                     start_mode=u'manual',
                                     env=self.lgce,
@@ -362,14 +362,14 @@
 class ComputedStartModeTC(ApycotBaseTC):
 
     def test_start_mode(self):
-        self.pyp.set_attributes(start_mode=u'monthly')
+        self.pyp.cw_set(start_mode=u'monthly')
         self.commit()
         self.assertEqual(self.pyp.computed_start_mode, self.pyp.start_mode)
-        self.lgc.set_attributes(start_mode=u'inherited')
+        self.lgc.cw_set(start_mode=u'inherited')
         self.commit()
         self.lgc.cw_clear_all_caches()
         self.assertEqual(self.lgc.computed_start_mode, self.pyp.start_mode)
-        self.pyp.set_attributes(start_mode=u'hourly')
+        self.pyp.cw_set(start_mode=u'hourly')
         self.commit()
         self.pyp.cw_clear_all_caches()
         self.lgc.cw_clear_all_caches()