R [all] logilab.common 0.44 provides only deprecated
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Fri, 31 Jul 2009 22:37:28 +0200
changeset 2613 5e19c2bb370e
parent 2612 c3059d308dc2
child 2614 351f1fcfa53c
R [all] logilab.common 0.44 provides only deprecated
appobject.py
common/mixins.py
cwconfig.py
cwvreg.py
devtools/apptest.py
entities/__init__.py
entity.py
schema.py
selectors.py
server/migractions.py
server/session.py
view.py
web/__init__.py
web/application.py
web/request.py
web/views/navigation.py
--- a/appobject.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/appobject.py	Fri Jul 31 22:37:28 2009 +0200
@@ -10,7 +10,7 @@
 from datetime import datetime, timedelta, time
 
 from logilab.common.decorators import classproperty
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 
 from rql.nodes import VariableRef, SubQuery
 from rql.stmts import Union, Select
@@ -101,7 +101,7 @@
         return '%s.%s.%s' % (cls.__registry__, cls.id, propid)
 
     @classproperty
-    @obsolete('use __select__ and & or | operators')
+    @deprecated('use __select__ and & or | operators')
     def __selectors__(cls):
         selector = cls.__select__
         if isinstance(selector, AndSelector):
--- a/common/mixins.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/common/mixins.py	Fri Jul 31 22:37:28 2009 +0200
@@ -8,7 +8,7 @@
 """
 __docformat__ = "restructuredtext en"
 
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached
 
 from cubicweb import typed_eid
@@ -242,7 +242,7 @@
 
     # specific vocabulary methods #############################################
 
-    @obsolete('use EntityFieldsForm.subject_in_state_vocabulary')
+    @deprecated('use EntityFieldsForm.subject_in_state_vocabulary')
     def subject_in_state_vocabulary(self, rschema, limit=None):
         form = self.vreg.select('forms', 'edition', self.req, entity=self)
         return form.subject_in_state_vocabulary(rschema, limit)
--- a/cwconfig.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/cwconfig.py	Fri Jul 31 22:37:28 2009 +0200
@@ -22,7 +22,7 @@
 from os.path import exists, join, expanduser, abspath, normpath, basename, isdir
 
 from logilab.common.decorators import cached
-from logilab.common.deprecation import deprecated_function
+from logilab.common.deprecation import deprecated
 from logilab.common.logging_ext import set_log_methods, init_log
 from logilab.common.configuration import (Configuration, Method,
                                           ConfigurationMixIn, merge_options)
@@ -866,4 +866,4 @@
 
 # alias to get a configuration instance from an instance id
 instance_configuration = CubicWebConfiguration.config_for
-application_configuration = deprecated_function(instance_configuration, 'use instance_configuration')
+application_configuration = deprecated('use instance_configuration')(instance_configuration)
--- a/cwvreg.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/cwvreg.py	Fri Jul 31 22:37:28 2009 +0200
@@ -9,7 +9,7 @@
 _ = unicode
 
 from logilab.common.decorators import cached, clear_cache
-from logilab.common.deprecation import  obsolete
+from logilab.common.deprecation import  deprecated
 
 from rql import RQLHelper
 
@@ -284,22 +284,22 @@
                 self.exception('error while trying to select %s view for %s',
                                vid, rset)
 
-    @obsolete("use .select_object('boxes', ...)")
+    @deprecated("use .select_object('boxes', ...)")
     def select_box(self, oid, *args, **kwargs):
         """return the most specific view according to the result set"""
         return self.select_object('boxes', oid, *args, **kwargs)
 
-    @obsolete("use .select_object('components', ...)")
+    @deprecated("use .select_object('components', ...)")
     def select_component(self, cid, *args, **kwargs):
         """return the most specific component according to the result set"""
         return self.select_object('components', cid, *args, **kwargs)
 
-    @obsolete("use .select_object('actions', ...)")
+    @deprecated("use .select_object('actions', ...)")
     def select_action(self, oid, *args, **kwargs):
         """return the most specific view according to the result set"""
         return self.select_object('actions', oid, *args, **kwargs)
 
-    @obsolete("use .select('views', ...)")
+    @deprecated("use .select('views', ...)")
     def select_view(self, __vid, req, rset=None, **kwargs):
         """return the most specific view according to the result set"""
         return self.select('views', __vid, req, rset=rset, **kwargs)
--- a/devtools/apptest.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/devtools/apptest.py	Fri Jul 31 22:37:28 2009 +0200
@@ -15,7 +15,7 @@
 from logilab.common.pytest import nocoverage
 from logilab.common.umessage import message_from_string
 
-from logilab.common.deprecation import deprecated_function
+from logilab.common.deprecation import deprecated
 
 from cubicweb.devtools import init_test_database, TestServerConfiguration, ApptestConfiguration
 from cubicweb.devtools._apptest import TestEnvironment
@@ -234,7 +234,7 @@
         return [(a.id, a.__class__) for a in self.vreg.possible_vobjects('actions', req, rset=rset)
                 if a.category in categories]
 
-    paddrelactions = deprecated_function(pactions_by_cats)
+    paddrelactions = deprecated()(pactions_by_cats)
 
     def pactionsdict(self, req, rset, skipcategories=('addrelated', 'siteactions', 'useractions')):
         res = {}
--- a/entities/__init__.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/entities/__init__.py	Fri Jul 31 22:37:28 2009 +0200
@@ -9,7 +9,7 @@
 
 from warnings import warn
 
-from logilab.common.deprecation import deprecated_function, obsolete
+from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached
 
 from cubicweb import Unauthorized, typed_eid
@@ -239,22 +239,22 @@
             wdg = widget(cls.vreg, tschema, rschema, cls, 'object')
         return wdg
 
-    @obsolete('use EntityFieldsForm.subject_relation_vocabulary')
+    @deprecated('use EntityFieldsForm.subject_relation_vocabulary')
     def subject_relation_vocabulary(self, rtype, limit):
         form = self.vreg.select('forms', 'edition', self.req, entity=self)
         return form.subject_relation_vocabulary(rtype, limit)
 
-    @obsolete('use EntityFieldsForm.object_relation_vocabulary')
+    @deprecated('use EntityFieldsForm.object_relation_vocabulary')
     def object_relation_vocabulary(self, rtype, limit):
         form = self.vreg.select('forms', 'edition', self.req, entity=self)
         return form.object_relation_vocabulary(rtype, limit)
 
-    @obsolete('use AutomaticEntityForm.[e]relations_by_category')
+    @deprecated('use AutomaticEntityForm.[e]relations_by_category')
     def relations_by_category(self, categories=None, permission=None):
         from cubicweb.web.views.autoform import AutomaticEntityForm
         return AutomaticEntityForm.erelations_by_category(self, categories, permission)
 
-    @obsolete('use AutomaticEntityForm.[e]srelations_by_category')
+    @deprecated('use AutomaticEntityForm.[e]srelations_by_category')
     def srelations_by_category(self, categories=None, permission=None):
         from cubicweb.web.views.autoform import AutomaticEntityForm
         return AutomaticEntityForm.esrelations_by_category(self, categories, permission)
--- a/entity.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/entity.py	Fri Jul 31 22:37:28 2009 +0200
@@ -12,7 +12,7 @@
 from logilab.common import interface
 from logilab.common.compat import all
 from logilab.common.decorators import cached
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 from logilab.mtconverter import TransformData, TransformError, xml_escape
 
 from rql.utils import rqlvar_maker
@@ -719,7 +719,7 @@
 
     # generic vocabulary methods ##############################################
 
-    @obsolete('see new form api')
+    @deprecated('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
--- a/schema.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/schema.py	Fri Jul 31 22:37:28 2009 +0200
@@ -14,7 +14,7 @@
 from warnings import warn
 
 from logilab.common.decorators import cached, clear_cache, monkeypatch
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 from logilab.common.compat import any
 
 from yams import BadSchemaDefinition, buildobjs as ybo
@@ -75,7 +75,7 @@
     # ensure unicode
     # added .lower() in case no translation are available
     return unicode(req._(key)).lower()
-__builtins__['display_name'] = obsolete('display_name should be imported from cubicweb.schema')(display_name)
+__builtins__['display_name'] = deprecated('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
--- a/selectors.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/selectors.py	Fri Jul 31 22:37:28 2009 +0200
@@ -46,7 +46,7 @@
 from warnings import warn
 
 from logilab.common.compat import all
-from logilab.common.deprecation import deprecated_function
+from logilab.common.deprecation import deprecated
 from logilab.common.interface import implements as implements_iface
 
 from yams import BASE_TYPES
@@ -976,86 +976,86 @@
 
 # XXX DEPRECATED ##############################################################
 
-yes_selector = deprecated_function(yes)
-norset_selector = deprecated_function(none_rset)
-rset_selector = deprecated_function(any_rset)
-anyrset_selector = deprecated_function(nonempty_rset)
-emptyrset_selector = deprecated_function(empty_rset)
-onelinerset_selector = deprecated_function(one_line_rset)
-twolinerset_selector = deprecated_function(two_lines_rset)
-twocolrset_selector = deprecated_function(two_cols_rset)
-largerset_selector = deprecated_function(paginated_rset)
-sortedrset_selector = deprecated_function(sorted_rset)
-oneetyperset_selector = deprecated_function(one_etype_rset)
-multitype_selector = deprecated_function(two_etypes_rset)
-anonymous_selector = deprecated_function(anonymous_user)
-not_anonymous_selector = deprecated_function(authenticated_user)
-primaryview_selector = deprecated_function(primary_view)
-contextprop_selector = deprecated_function(match_context_prop)
+yes_selector = deprecated()(yes)
+norset_selector = deprecated()(none_rset)
+rset_selector = deprecated()(any_rset)
+anyrset_selector = deprecated()(nonempty_rset)
+emptyrset_selector = deprecated()(empty_rset)
+onelinerset_selector = deprecated()(one_line_rset)
+twolinerset_selector = deprecated()(two_lines_rset)
+twocolrset_selector = deprecated()(two_cols_rset)
+largerset_selector = deprecated()(paginated_rset)
+sortedrset_selector = deprecated()(sorted_rset)
+oneetyperset_selector = deprecated()(one_etype_rset)
+multitype_selector = deprecated()(two_etypes_rset)
+anonymous_selector = deprecated()(anonymous_user)
+not_anonymous_selector = deprecated()(authenticated_user)
+primaryview_selector = deprecated()(primary_view)
+contextprop_selector = deprecated()(match_context_prop)
 
+@deprecated('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)
-nfentity_selector = deprecated_function(nfentity_selector)
 
+@deprecated('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_function(implement_interface)
-interface_selector = deprecated_function(implement_interface)
-implement_interface = deprecated_function(implement_interface, 'use implements')
+_interface_selector = deprecated()(implement_interface)
+interface_selector = deprecated()(implement_interface)
 
+@deprecated('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 = deprecated_function(accept_etype)
-accept_etype = deprecated_function(accept_etype, 'use specified_etype_implements')
+etype_form_selector = accept_etype
 
+@deprecated('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)
-searchstate_selector = deprecated_function(searchstate_selector)
 
+@deprecated('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 = deprecated_function(match_user_group)
-match_user_group = deprecated_function(match_user_group)
+in_group_selector = match_user_group
 
+@deprecated('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)
-has_relation = deprecated_function(has_relation)
 
+@deprecated('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)
-one_has_relation = deprecated_function(one_has_relation, 'use relation_possible selector')
 
+@deprecated('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 = deprecated_function(accept_rset)
-accept_rset = deprecated_function(accept_rset, 'use implements selector')
+accept_rset_selector = accept_rset
 
 accept = chainall(non_final_entity(), accept_rset, name='accept')
-accept_selector = deprecated_function(accept)
-accept = deprecated_function(accept, 'use implements selector')
+accept = deprecated('use implements selector')(accept)
+accept_selector = deprecated()(accept)
 
-accept_one = deprecated_function(chainall(one_line_rset, accept,
+accept_one = deprecated()(chainall(one_line_rset, accept,
                                           name='accept_one'))
-accept_one_selector = deprecated_function(accept_one)
+accept_one_selector = deprecated()(accept_one)
 
 
 def _rql_condition(cls, req, rset=None, row=None, col=0, **kwargs):
     if cls.condition:
         return rql_condition(cls.condition)(cls, req, rset, row, col)
     return 1
-_rqlcondition_selector = deprecated_function(_rql_condition)
+_rqlcondition_selector = deprecated()(_rql_condition)
 
-rqlcondition_selector = deprecated_function(chainall(non_final_entity(), one_line_rset, _rql_condition,
+rqlcondition_selector = deprecated()(chainall(non_final_entity(), one_line_rset, _rql_condition,
                          name='rql_condition'))
 
+@deprecated('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)
-but_etype_selector = deprecated_function(but_etype_selector)
 
 @lltrace
 def etype_rtype_selector(cls, req, rset=None, row=None, col=0, **kwargs):
@@ -1070,24 +1070,25 @@
         if not (rschema.has_perm(req, perm) or rschema.has_local_role(perm)):
             return 0
     return 1
-etype_rtype_selector = deprecated_function(etype_rtype_selector)
+etype_rtype_selector = deprecated()(etype_rtype_selector)
 
-#req_form_params_selector = deprecated_function(match_form_params) # form_params
-#kwargs_selector = deprecated_function(match_kwargs) # expected_kwargs
+#req_form_params_selector = deprecated()(match_form_params) # form_params
+#kwargs_selector = deprecated()(match_kwargs) # expected_kwargs
 
 # compound selectors ##########################################################
 
 searchstate_accept = chainall(nonempty_rset(), accept,
                               name='searchstate_accept')
-searchstate_accept_selector = deprecated_function(searchstate_accept)
+searchstate_accept_selector = deprecated()(searchstate_accept)
 
 searchstate_accept_one = chainall(one_line_rset, accept, _rql_condition,
                                   name='searchstate_accept_one')
-searchstate_accept_one_selector = deprecated_function(searchstate_accept_one)
+searchstate_accept_one_selector = deprecated()(searchstate_accept_one)
 
-searchstate_accept = deprecated_function(searchstate_accept)
-searchstate_accept_one = deprecated_function(searchstate_accept_one)
+searchstate_accept = deprecated()(searchstate_accept)
+searchstate_accept_one = deprecated()(searchstate_accept_one)
 
+# end of deprecation section ##################################################
 
 def unbind_method(selector):
     def new_selector(registered):
--- a/server/migractions.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/server/migractions.py	Fri Jul 31 22:37:28 2009 +0200
@@ -22,7 +22,7 @@
 from os.path import join, exists
 from datetime import datetime
 
-from logilab.common.deprecation import deprecated_function, obsolete
+from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached, clear_cache
 from logilab.common.adbh import get_adv_func_helper
 
@@ -198,9 +198,9 @@
                         'fsschema': self.fs_schema,
                         'session' : self.session,
                         'repo' : self.repo,
-                        'synchronize_schema': deprecated_function(self.cmd_sync_schema_props_perms),
-                        'synchronize_eschema': deprecated_function(self.cmd_sync_schema_props_perms),
-                        'synchronize_rschema': deprecated_function(self.cmd_sync_schema_props_perms),
+                        '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),
                         })
         return context
 
@@ -837,7 +837,7 @@
         if commit:
             self.commit()
 
-    @obsolete('use sync_schema_props_perms(ertype, syncprops=False)')
+    @deprecated('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	Fri Jul 31 19:18:33 2009 +0200
+++ b/server/session.py	Fri Jul 31 22:37:28 2009 +0200
@@ -11,7 +11,7 @@
 import threading
 from time import time
 
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 from rql.nodes import VariableRef, Function, ETYPE_PYOBJ_MAP, etype_from_pyobj
 from yams import BASE_TYPES
 
@@ -454,7 +454,7 @@
             description.append(tuple(row_descr))
         return description
 
-    @obsolete('use direct access to session.transaction_data')
+    @deprecated('use direct access to session.transaction_data')
     def query_data(self, key, default=None, setdefault=False, pop=False):
         if setdefault:
             assert not pop
@@ -464,7 +464,7 @@
         else:
             return self.transaction_data.get(key, default)
 
-    @obsolete('use entity_from_eid(eid, etype=None)')
+    @deprecated('use entity_from_eid(eid, etype=None)')
     def entity(self, eid):
         """return a result set for the given eid"""
         return self.eid_rset(eid).get_entity(0, 0)
--- a/view.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/view.py	Fri Jul 31 22:37:28 2009 +0200
@@ -11,7 +11,7 @@
 
 from cStringIO import StringIO
 
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 from logilab.mtconverter import xml_escape
 
 from cubicweb import NotAnEntity
@@ -150,7 +150,7 @@
         if stream is not None:
             return self._stream.getvalue()
 
-    dispatch = obsolete('.dispatch is deprecated, use .render')(render)
+    dispatch = deprecated('.dispatch is deprecated, use .render')(render)
 
     # should default .call() method add a <div classs="section"> around each
     # rset item
@@ -229,7 +229,7 @@
         self.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
 
     # XXX Template bw compat
-    template = obsolete('.template is deprecated, use .view')(wview)
+    template = deprecated('.template is deprecated, use .view')(wview)
 
     def whead(self, data):
         self.req.html_headers.write(data)
--- a/web/__init__.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/web/__init__.py	Fri Jul 31 22:37:28 2009 +0200
@@ -14,7 +14,7 @@
 from datetime import datetime, date, timedelta
 from simplejson import dumps
 
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 
 from cubicweb.common.uilib import urlquote
 from cubicweb.web._exceptions import *
@@ -65,7 +65,7 @@
         return json_dumps(function(*args, **kwargs))
     return newfunc
 
-@obsolete('use req.build_ajax_replace_url() instead')
+@deprecated('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	Fri Jul 31 19:18:33 2009 +0200
+++ b/web/application.py	Fri Jul 31 22:37:28 2009 +0200
@@ -10,7 +10,7 @@
 import sys
 from time import clock, time
 
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 
 from rql import BadRQLQuery
 
@@ -272,7 +272,7 @@
             finally:
                 self._logfile_lock.release()
 
-    @obsolete("use vreg.select('controllers', ...)")
+    @deprecated("use vreg.select('controllers', ...)")
     def select_controller(self, oid, req):
         try:
             return self.vreg.select('controllers', oid, req=req, appli=self)
--- a/web/request.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/web/request.py	Fri Jul 31 22:37:28 2009 +0200
@@ -18,7 +18,7 @@
 from rql.utils import rqlvar_maker
 
 from logilab.common.decorators import cached
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 
 from logilab.mtconverter import xml_escape
 
@@ -630,7 +630,7 @@
                            auth, ex.__class__.__name__, ex)
         return None, None
 
-    @obsolete("use parse_accept_header('Accept-Language')")
+    @deprecated("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
--- a/web/views/navigation.py	Fri Jul 31 19:18:33 2009 +0200
+++ b/web/views/navigation.py	Fri Jul 31 22:37:28 2009 +0200
@@ -11,7 +11,7 @@
 from rql.nodes import VariableRef, Constant
 
 from logilab.mtconverter import xml_escape
-from logilab.common.deprecation import obsolete
+from logilab.common.deprecation import deprecated
 
 from cubicweb.interfaces import IPrevNext
 from cubicweb.selectors import (paginated_rset, sorted_rset,
@@ -168,7 +168,7 @@
 # monkey patch base View class to add a .pagination(req, rset, w, forcedisplay)
 # method to be called on view's result set and printing pages index in the view
 from cubicweb.view import View
-View.pagination = obsolete('.pagination is deprecated, use paginate')(limit_rset_using_paged_nav)
+View.pagination = deprecated('.pagination is deprecated, use paginate')(limit_rset_using_paged_nav)
 
 def paginate(view, show_all_option=True, w=None, page_size=None):
     limit_rset_using_paged_nav(view, view.req, view.rset, w or view.w,