some fixes so that deprecation warning are properly localized
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 25 Jan 2010 19:18:33 +0100
changeset 4339 fe93b670343d
parent 4338 0eb7efcbcee1
child 4340 cc0fe6279181
some fixes so that deprecation warning are properly localized
rtags.py
server/hook.py
server/migractions.py
web/uicfg.py
--- a/rtags.py	Mon Jan 25 19:16:35 2010 +0100
+++ b/rtags.py	Mon Jan 25 19:18:33 2010 +0100
@@ -87,7 +87,8 @@
     def tag_attribute(self, key, *args, **kwargs):
         key = list(key)
         key.append('*')
-        self.tag_subject_of(key, *args, **kwargs)
+        key.append('subject')
+        self.tag_relation(key, *args, **kwargs)
 
     def tag_subject_of(self, key, *args, **kwargs):
         key = list(key)
--- a/server/hook.py	Mon Jan 25 19:16:35 2010 +0100
+++ b/server/hook.py	Mon Jan 25 19:18:33 2010 +0100
@@ -82,7 +82,7 @@
             if hook.enabled:
                 hook()
             else:
-                warn('[3.6] %s: enabled is deprecated' % self.__class__)
+                warn('[3.6] %s: enabled is deprecated' % hook.__class__)
 
 VRegistry.REGISTRY_FACTORY['hooks'] = HooksRegistry
 
--- a/server/migractions.py	Mon Jan 25 19:16:35 2010 +0100
+++ b/server/migractions.py	Mon Jan 25 19:18:33 2010 +0100
@@ -1053,7 +1053,8 @@
             return rset.get_entity(0, 0)
         return self.cmd_add_workflow('%s workflow' % ';'.join(etypes), etypes)
 
-    @deprecated('[3.5] use add_workflow and Workflow.add_state method')
+    @deprecated('[3.5] use add_workflow and Workflow.add_state method',
+                stacklevel=3)
     def cmd_add_state(self, name, stateof, initial=False, commit=False, **kwargs):
         """method to ease workflow definition: add a state for one or more
         entity type(s)
@@ -1064,7 +1065,8 @@
             self.commit()
         return state.eid
 
-    @deprecated('[3.5] use add_workflow and Workflow.add_transition method')
+    @deprecated('[3.5] use add_workflow and Workflow.add_transition method',
+                stacklevel=3)
     def cmd_add_transition(self, name, transitionof, fromstates, tostate,
                            requiredgroups=(), conditions=(), commit=False, **kwargs):
         """method to ease workflow definition: add a transition for one or more
@@ -1077,7 +1079,8 @@
             self.commit()
         return tr.eid
 
-    @deprecated('[3.5] use Transition.set_transition_permissions method')
+    @deprecated('[3.5] use Transition.set_transition_permissions method',
+                stacklevel=3)
     def cmd_set_transition_permissions(self, treid,
                                        requiredgroups=(), conditions=(),
                                        reset=True, commit=False):
@@ -1089,7 +1092,8 @@
         if commit:
             self.commit()
 
-    @deprecated('[3.5] use entity.fire_transition("transition") or entity.change_state("state")')
+    @deprecated('[3.5] use entity.fire_transition("transition") or entity.change_state("state")',
+                stacklevel=3)
     def cmd_set_state(self, eid, statename, commit=False):
         self._cw.entity_from_eid(eid).change_state(statename)
         if commit:
--- a/web/uicfg.py	Mon Jan 25 19:16:35 2010 +0100
+++ b/web/uicfg.py	Mon Jan 25 19:18:33 2010 +0100
@@ -436,7 +436,7 @@
     def tag_relation(self, key, tag):
         warn('autoform_is_inlined rtag is deprecated, use autoform_section '
              'with inlined formtype and "attributes" or "hidden" section',
-             DeprecationWarning, stacklevel=2)
+             DeprecationWarning, stacklevel=3)
         section = tag and 'inlined' or 'hidden'
         autoform_section.tag_relation(key, 'main', section)