R put version info in deprecation warnings
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 12 Aug 2009 18:40:52 +0200
changeset 2788 8d3dbe577d3a
parent 2787 ece5bbed3cd2
child 2789 39712da6f397
R put version info in deprecation warnings
appobject.py
entity.py
schema.py
selectors.py
server/migractions.py
server/session.py
view.py
vregistry.py
web/__init__.py
web/application.py
web/request.py
--- a/appobject.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/appobject.py	Wed Aug 12 18:40:52 2009 +0200
@@ -327,7 +327,7 @@
         return '%s.%s.%s' % (cls.__registry__, cls.id, propid)
 
     @classproperty
-    @deprecated('use __select__ and & or | operators')
+    @deprecated('[3.4] use __select__ and & or | operators')
     def __selectors__(cls):
         selector = cls.__select__
         if isinstance(selector, AndSelector):
@@ -454,7 +454,7 @@
 
     # various resources accessors #############################################
 
-    @deprecated('use self.rset.get_entity(row,col) instead')
+    @deprecated('[3.5] use self.rset.get_entity(row,col) instead')
     def entity(self, row, col=0):
         """short cut to get an entity instance for a particular row/column
         (col default to 0)
--- a/entity.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/entity.py	Wed Aug 12 18:40:52 2009 +0200
@@ -715,7 +715,7 @@
 
     # generic vocabulary methods ##############################################
 
-    @deprecated('see new form api')
+    @deprecated('[3.4] see new form api')
     def vocabulary(self, rtype, role='subject', limit=None):
         """vocabulary functions must return a list of couples
         (label, eid) that will typically be used to fill the
@@ -941,7 +941,7 @@
     def __set__(self, eobj, value):
         # XXX bw compat
         # would be better to generate UPDATE queries than the current behaviour
-        eobj.warning("deprecated usage, don't use 'entity.attr = val' notation)")
+        eobj.warning("[3.4] deprecated usage, don't use 'entity.attr = val' notation)")
         eobj[self._attrname] = value
 
 
--- a/schema.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/schema.py	Wed Aug 12 18:40:52 2009 +0200
@@ -79,7 +79,7 @@
     # ensure unicode
     # added .lower() in case no translation are available
     return unicode(req._(key)).lower()
-__builtins__['display_name'] = deprecated('display_name should be imported from cubicweb.schema')(display_name)
+__builtins__['display_name'] = deprecated('[3.4] display_name should be imported from cubicweb.schema')(display_name)
 
 def ERSchema_display_name(self, req, form=''):
     """return a internationalized string for the entity/relation type name in
@@ -949,5 +949,6 @@
 
 # XXX deprecated
 from yams.constraints import format_constraint
+format_constraint = deprecated('[3.4] use RichString instead of format_constraint')(format_constraint)
 from yams.buildobjs import RichString
 PyFileReader.context['format_constraint'] = format_constraint
--- a/selectors.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/selectors.py	Wed Aug 12 18:40:52 2009 +0200
@@ -963,7 +963,7 @@
         self.score_entity = scorefunc
 
 
-# XXX DEPRECATED ##############################################################
+# XXX DEPRECATED in 3.4 ########################################################
 from cubicweb.vregistry import chainall
 
 yes_selector = deprecated()(yes)
@@ -983,50 +983,50 @@
 primaryview_selector = deprecated()(primary_view)
 contextprop_selector = deprecated()(match_context_prop)
 
-@deprecated('use non_final_entity instead of %s')
+@deprecated('[3.4] use non_final_entity instead of %s')
 def nfentity_selector(cls, req, rset=None, row=None, col=0, **kwargs):
     return non_final_entity()(cls, req, rset, row, col)
 
-@deprecated('use implements instead of %s')
+@deprecated('[3.4] use implements instead of %s')
 def implement_interface(cls, req, rset=None, row=None, col=0, **kwargs):
     return implements(*cls.accepts_interfaces)(cls, req, rset, row, col)
 _interface_selector = deprecated()(implement_interface)
 interface_selector = deprecated()(implement_interface)
 
-@deprecated('use specified_etype_implements instead of %s')
+@deprecated('[3.4] use specified_etype_implements instead of %s')
 def accept_etype(cls, req, *args, **kwargs):
     """check etype presence in request form *and* accepts conformance"""
     return specified_etype_implements(*cls.accepts)(cls, req, *args)
 etype_form_selector = accept_etype
 
-@deprecated('use match_search_state instead of %s')
+@deprecated('[3.4] use match_search_state instead of %s')
 def searchstate_selector(cls, req, rset=None, row=None, col=0, **kwargs):
     return match_search_state(cls.search_states)(cls, req, rset, row, col)
 
-@deprecated('use match_user_groups instead of %s')
+@deprecated('[3.4] use match_user_groups instead of %s')
 def match_user_group(cls, req, rset=None, row=None, col=0, **kwargs):
     return match_user_groups(*cls.require_groups)(cls, req, rset, row, col, **kwargs)
 in_group_selector = match_user_group
 
-@deprecated('use relation_possible instead of %s')
+@deprecated('[3.4] use relation_possible instead of %s')
 def has_relation(cls, req, rset=None, row=None, col=0, **kwargs):
     return relation_possible(cls.rtype, role(cls), cls.etype,
                              getattr(cls, 'require_permission', 'read'))(cls, req, rset, row, col, **kwargs)
 
-@deprecated('use relation_possible instead of %s')
+@deprecated('[3.4] use relation_possible instead of %s')
 def one_has_relation(cls, req, rset=None, row=None, col=0, **kwargs):
     return relation_possible(cls.rtype, role(cls), cls.etype,
                              getattr(cls, 'require_permission', 'read',
                                      once_is_enough=True))(cls, req, rset, row, col, **kwargs)
 
-@deprecated('use implements instead of %s')
+@deprecated('[3.4] use implements instead of %s')
 def accept_rset(cls, req, rset=None, row=None, col=0, **kwargs):
     """simply delegate to cls.accept_rset method"""
     return implements(*cls.accepts)(cls, req, rset, row=row, col=col)
 accept_rset_selector = accept_rset
 
 accept = chainall(non_final_entity(), accept_rset, name='accept')
-accept = deprecated('use implements selector')(accept)
+accept = deprecated('[3.4] use implements selector')(accept)
 accept_selector = deprecated()(accept)
 
 accept_one = deprecated()(chainall(one_line_rset, accept,
@@ -1043,7 +1043,7 @@
 rqlcondition_selector = deprecated()(chainall(non_final_entity(), one_line_rset, _rql_condition,
                          name='rql_condition'))
 
-@deprecated('use but_etype instead of %s')
+@deprecated('[3.4] use but_etype instead of %s')
 def but_etype_selector(cls, req, rset=None, row=None, col=0, **kwargs):
     return but_etype(cls.etype)(cls, req, rset, row, col)
 
--- a/server/migractions.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/server/migractions.py	Wed Aug 12 18:40:52 2009 +0200
@@ -254,9 +254,9 @@
                         'fsschema': self.fs_schema,
                         'session' : self.session,
                         'repo' : self.repo,
-                        'synchronize_schema': deprecated()(self.cmd_sync_schema_props_perms),
-                        'synchronize_eschema': deprecated()(self.cmd_sync_schema_props_perms),
-                        'synchronize_rschema': deprecated()(self.cmd_sync_schema_props_perms),
+                        'synchronize_schema': deprecated()(self.cmd_sync_schema_props_perms), # 3.4
+                        'synchronize_eschema': deprecated()(self.cmd_sync_schema_props_perms), # 3.4
+                        'synchronize_rschema': deprecated()(self.cmd_sync_schema_props_perms), # 3.4
                         })
         return context
 
@@ -909,7 +909,7 @@
         if commit:
             self.commit()
 
-    @deprecated('use sync_schema_props_perms(ertype, syncprops=False)')
+    @deprecated('[3.4] use sync_schema_props_perms(ertype, syncprops=False)')
     def cmd_synchronize_permissions(self, ertype, commit=True):
         self.cmd_sync_schema_props_perms(ertype, syncprops=False, commit=commit)
 
--- a/server/session.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/server/session.py	Wed Aug 12 18:40:52 2009 +0200
@@ -552,12 +552,12 @@
             description.append(tuple(row_descr))
         return description
 
-    @deprecated("use vreg['etypes'].etype_class(etype)")
+    @deprecated("[3.4] use vreg['etypes'].etype_class(etype)")
     def etype_class(self, etype):
         """return an entity class for the given entity type"""
         return self.vreg['etypes'].etype_class(etype)
 
-    @deprecated('use direct access to session.transaction_data')
+    @deprecated('[3.4] use direct access to session.transaction_data')
     def query_data(self, key, default=None, setdefault=False, pop=False):
         if setdefault:
             assert not pop
@@ -567,7 +567,7 @@
         else:
             return self.transaction_data.get(key, default)
 
-    @deprecated('use entity_from_eid(eid, etype=None)')
+    @deprecated('[3.4] use entity_from_eid(eid, etype=None)')
     def entity(self, eid):
         """return a result set for the given eid"""
         return self.entity_from_eid(eid)
--- a/view.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/view.py	Wed Aug 12 18:40:52 2009 +0200
@@ -151,7 +151,7 @@
         if stream is not None:
             return self._stream.getvalue()
 
-    dispatch = deprecated('.dispatch is deprecated, use .render')(render)
+    dispatch = deprecated('[3.4] .dispatch is deprecated, use .render')(render)
 
     # should default .call() method add a <div classs="section"> around each
     # rset item
@@ -230,7 +230,7 @@
         self.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
 
     # XXX Template bw compat
-    template = deprecated('.template is deprecated, use .view')(wview)
+    template = deprecated('[3.4] .template is deprecated, use .view')(wview)
 
     def whead(self, data):
         self.req.html_headers.write(data)
--- a/vregistry.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/vregistry.py	Wed Aug 12 18:40:52 2009 +0200
@@ -125,7 +125,7 @@
 
     # dynamic selection methods ################################################
 
-    @deprecated('use select instead of object_by_id')
+    @deprecated('[3.5] use select instead of object_by_id')
     def object_by_id(self, oid, *args, **kwargs):
         """return object with the given oid. Only one object is expected to be
         found.
@@ -154,7 +154,7 @@
             return self.select(oid, *args, **kwargs)
         except (NoSelectableObject, ObjectNotFound):
             return None
-    select_object = deprecated('use select_or_none instead of select_object'
+    select_object = deprecated('[3.5] use select_or_none instead of select_object'
                                )(select_or_none)
 
     def possible_objects(self, *args, **kwargs):
@@ -197,7 +197,7 @@
                                    [repr(v) for v in winners]))
         # return the result of calling the appobject
         return winners[0](*args, **kwargs)
-    select_best = deprecated('select_best is now private')(_select_best)
+    select_best = deprecated('[3.5] select_best is now private')(_select_best)
 
 class VRegistry(dict):
     """class responsible to register, propose and select the various
@@ -224,7 +224,7 @@
 
     # dynamic selection methods ################################################
 
-    @deprecated('use vreg[registry].object_by_id(oid, *args, **kwargs)')
+    @deprecated('[3.4] use vreg[registry].object_by_id(oid, *args, **kwargs)')
     def object_by_id(self, registry, oid, *args, **kwargs):
         """return object in <registry>.<oid>
 
@@ -233,7 +233,7 @@
         """
         return self[registry].object_by_id(oid)
 
-    @deprecated('use vreg[registry].select(oid, *args, **kwargs)')
+    @deprecated('[3.4] use vreg[registry].select(oid, *args, **kwargs)')
     def select(self, registry, oid, *args, **kwargs):
         """return the most specific object in <registry>.<oid> according to
         the given context
@@ -243,14 +243,14 @@
         """
         return self[registry].select(oid, *args, **kwargs)
 
-    @deprecated('use vreg[registry].select_or_none(oid, *args, **kwargs)')
+    @deprecated('[3.4] use vreg[registry].select_or_none(oid, *args, **kwargs)')
     def select_object(self, registry, oid, *args, **kwargs):
         """return the most specific object in <registry>.<oid> according to
         the given context, or None if no object apply
         """
         return self[registry].select_or_none(oid, *args, **kwargs)
 
-    @deprecated('use vreg[registry].possible_objects(*args, **kwargs)')
+    @deprecated('[3.4] use vreg[registry].possible_objects(*args, **kwargs)')
     def possible_objects(self, registry, *args, **kwargs):
         """return an iterator on possible objects in <registry> for the given
         context
@@ -434,11 +434,11 @@
 
 from cubicweb.appobject import objectify_selector, AndSelector, OrSelector, Selector
 
-objectify_selector = deprecated('objectify_selector has been moved to appobject module')(objectify_selector)
+objectify_selector = deprecated('[3.4] objectify_selector has been moved to appobject module')(objectify_selector)
 
 Selector = class_moved(Selector)
 
-@deprecated('use & operator (binary and)')
+@deprecated('[3.4] use & operator (binary and)')
 def chainall(*selectors, **kwargs):
     """return a selector chaining given selectors. If one of
     the selectors fail, selection will fail, else the returned score
@@ -451,7 +451,7 @@
         selector.__name__ = kwargs['name']
     return selector
 
-@deprecated('use | operator (binary or)')
+@deprecated('[3.4] use | operator (binary or)')
 def chainfirst(*selectors, **kwargs):
     """return a selector chaining given selectors. If all
     the selectors fail, selection will fail, else the returned score
--- a/web/__init__.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/web/__init__.py	Wed Aug 12 18:40:52 2009 +0200
@@ -65,7 +65,7 @@
         return json_dumps(function(*args, **kwargs))
     return newfunc
 
-@deprecated('use req.build_ajax_replace_url() instead')
+@deprecated('[3.4] use req.build_ajax_replace_url() instead')
 def ajax_replace_url(nodeid, rql, vid=None, swap=False, **extraparams):
     """builds a replacePageChunk-like url
     >>> ajax_replace_url('foo', 'Person P')
--- a/web/application.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/web/application.py	Wed Aug 12 18:40:52 2009 +0200
@@ -289,7 +289,7 @@
             finally:
                 self._logfile_lock.release()
 
-    @deprecated("use vreg.select('controllers', ...)")
+    @deprecated("[3.4] use vreg['controllers'].select(...)")
     def select_controller(self, oid, req):
         try:
             return self.vreg['controllers'].select(oid, req=req, appli=self)
--- a/web/request.py	Wed Aug 12 18:16:49 2009 +0200
+++ b/web/request.py	Wed Aug 12 18:40:52 2009 +0200
@@ -629,7 +629,7 @@
                            auth, ex.__class__.__name__, ex)
         return None, None
 
-    @deprecated("use parse_accept_header('Accept-Language')")
+    @deprecated("[3.4] use parse_accept_header('Accept-Language')")
     def header_accept_language(self):
         """returns an ordered list of preferred languages"""
         return [value.split('-')[0] for value in