[diet] drop pre 3.6 API compatibility (but attempt to keep data cmopatibility). Closes #2017916
notice drop of the .paginable property necessary for 'paginable' affectation as done in the
forthcoming table views refactoring
--- a/appobject.py Fri Oct 21 14:32:18 2011 +0200
+++ b/appobject.py Fri Oct 21 14:32:37 2011 +0200
@@ -43,12 +43,6 @@
def class_regid(cls):
"""returns a unique identifier for an appobject class"""
- if 'id' in cls.__dict__:
- warn('[3.6] %s.%s: id is deprecated, use __regid__'
- % (cls.__module__, cls.__name__), DeprecationWarning)
- cls.__regid__ = cls.id
- if hasattr(cls, 'id') and not isinstance(cls.id, property):
- return cls.id
return cls.__regid__
# helpers for debugging selectors
@@ -414,13 +408,7 @@
the right hook to create an instance for example). By default the
appobject is returned without any transformation.
"""
- try: # XXX < 3.6 bw compat
- pdefs = cls.property_defs # pylint: disable=E1101
- except AttributeError:
- pdefs = getattr(cls, 'cw_property_defs', {})
- else:
- warn('[3.6] property_defs is deprecated, use cw_property_defs in %s'
- % cls, DeprecationWarning)
+ pdefs = getattr(cls, 'cw_property_defs', {})
for propid, pdef in pdefs.items():
pdef = pdef.copy() # may be shared
pdef['default'] = getattr(cls, propid, pdef['default'])
@@ -471,113 +459,6 @@
"""
return self._cw.property_value(self._cwpropkey(propid))
- # deprecated ###############################################################
-
- @property
- @deprecated('[3.6] use self.__regid__')
- def id(self):
- return self.__regid__
-
- @property
- @deprecated('[3.6] use self._cw.vreg')
- def vreg(self):
- return self._cw.vreg
-
- @property
- @deprecated('[3.6] use self._cw.vreg.schema')
- def schema(self):
- return self._cw.vreg.schema
-
- @property
- @deprecated('[3.6] use self._cw.vreg.config')
- def config(self):
- return self._cw.vreg.config
-
- @property
- @deprecated('[3.6] use self._cw')
- def req(self):
- return self._cw
-
- @deprecated('[3.6] use self.cw_rset')
- def get_rset(self):
- return self.cw_rset
- @deprecated('[3.6] use self.cw_rset')
- def set_rset(self, rset):
- self.cw_rset = rset
- rset = property(get_rset, set_rset)
-
- @property
- @deprecated('[3.6] use self.cw_row')
- def row(self):
- return self.cw_row
-
- @property
- @deprecated('[3.6] use self.cw_col')
- def col(self):
- return self.cw_col
-
- @property
- @deprecated('[3.6] use self.cw_extra_kwargs')
- def extra_kwargs(self):
- return self.cw_extra_kwargs
-
- @deprecated('[3.6] use self._cw.view')
- def view(self, *args, **kwargs):
- return self._cw.view(*args, **kwargs)
-
- @property
- @deprecated('[3.6] use self._cw.varmaker')
- def varmaker(self):
- return self._cw.varmaker
-
- @deprecated('[3.6] use self._cw.get_cache')
- def get_cache(self, cachename):
- return self._cw.get_cache(cachename)
-
- @deprecated('[3.6] use self._cw.build_url')
- def build_url(self, *args, **kwargs):
- return self._cw.build_url(*args, **kwargs)
-
- @deprecated('[3.6] use self.cw_rset.limited_rql')
- def limited_rql(self):
- return self.cw_rset.limited_rql()
-
- @deprecated('[3.6] use self.cw_rset.complete_entity(row,col) instead')
- def complete_entity(self, row, col=0, skip_bytes=True):
- return self.cw_rset.complete_entity(row, col, skip_bytes)
-
- @deprecated('[3.6] use self.cw_rset.get_entity(row,col) instead')
- def entity(self, row, col=0):
- return self.cw_rset.get_entity(row, col)
-
- @deprecated('[3.6] use self._cw.user_rql_callback')
- def user_rql_callback(self, args, msg=None):
- return self._cw.user_rql_callback(args, msg)
-
- @deprecated('[3.6] use self._cw.user_callback')
- def user_callback(self, cb, args, msg=None, nonify=False):
- return self._cw.user_callback(cb, args, msg, nonify)
-
- @deprecated('[3.6] use self._cw.format_date')
- def format_date(self, date, date_format=None, time=False):
- return self._cw.format_date(date, date_format, time)
-
- @deprecated('[3.6] use self._cw.format_time')
- def format_time(self, time):
- return self._cw.format_time(time)
-
- @deprecated('[3.6] use self._cw.format_float')
- def format_float(self, num):
- return self._cw.format_float(num)
-
- @deprecated('[3.6] use self._cw.parse_datetime')
- def parse_datetime(self, value, etype='Datetime'):
- return self._cw.parse_datetime(value, etype)
-
- @deprecated('[3.6] use self.cw_propval')
- def propval(self, propid):
- return self._cw.property_value(self._cwpropkey(propid))
-
# these are overridden by set_log_methods below
# only defining here to prevent pylint from complaining
info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
--- a/common/__init__.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""Common subpackage of cubicweb : defines library functions used both on the
-hg stserver side and on the client side
-
-"""
-
--- a/common/mail.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""pre 3.6 bw compat"""
-# pylint: disable=W0614,W0401
-from warnings import warn
-warn('moved to cubicweb.mail', DeprecationWarning, stacklevel=2)
-from cubicweb.mail import *
--- a/common/mixins.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""pre 3.6 bw compat"""
-# pylint: disable=W0614,W0401
-from warnings import warn
-warn('moved to cubicweb.mixins', DeprecationWarning, stacklevel=2)
-from cubicweb.mixins import *
--- a/common/mttransforms.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""pre 3.6 bw compat"""
-# pylint: disable=W0614,W0401
-from warnings import warn
-warn('moved to cubicweb.mttransforms', DeprecationWarning, stacklevel=2)
-from cubicweb.mttransforms import *
--- a/common/tags.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""pre 3.6 bw compat"""
-# pylint: disable=W0614,W0401
-from warnings import warn
-warn('moved to cubicweb.tags', DeprecationWarning, stacklevel=2)
-from cubicweb.tags import *
--- a/common/uilib.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""pre 3.6 bw compat"""
-# pylint: disable=W0614,W0401
-from warnings import warn
-warn('moved to cubicweb.uilib', DeprecationWarning, stacklevel=2)
-from cubicweb.uilib import *
--- a/cwconfig.py Fri Oct 21 14:32:18 2011 +0200
+++ b/cwconfig.py Fri Oct 21 14:32:37 2011 +0200
@@ -612,7 +612,6 @@
ctlfile, err)
cls.info('loaded cubicweb-ctl plugin %s', ctlfile)
for cube in cls.available_cubes():
- oldpluginfile = join(cls.cube_dir(cube), 'ecplugin.py')
pluginfile = join(cls.cube_dir(cube), 'ccplugin.py')
initfile = join(cls.cube_dir(cube), '__init__.py')
if exists(pluginfile):
@@ -621,14 +620,6 @@
cls.info('loaded cubicweb-ctl plugin from %s', cube)
except Exception:
cls.exception('while loading plugin %s', pluginfile)
- elif exists(oldpluginfile):
- warn('[3.6] %s: ecplugin module should be renamed to ccplugin' % cube,
- DeprecationWarning)
- try:
- __import__('cubes.%s.ecplugin' % cube)
- cls.info('loaded cubicweb-ctl plugin from %s', cube)
- except Exception:
- cls.exception('while loading plugin %s', oldpluginfile)
elif exists(initfile):
try:
__import__('cubes.%s' % cube)
@@ -762,13 +753,6 @@
if exists(sitefile) and not sitefile in self._site_loaded:
self._load_site_cubicweb(sitefile)
self._site_loaded.add(sitefile)
- else:
- sitefile = join(path, 'site_erudi.py')
- if exists(sitefile) and not sitefile in self._site_loaded:
- self._load_site_cubicweb(sitefile)
- self._site_loaded.add(sitefile)
- self.warning('[3.5] site_erudi.py is deprecated, should be '
- 'renamed to site_cubicweb.py')
def _load_site_cubicweb(self, sitefile):
# XXX extrapath argument to load_module_from_file only in lgc > 0.50.2
--- a/cwvreg.py Fri Oct 21 14:32:18 2011 +0200
+++ b/cwvreg.py Fri Oct 21 14:32:37 2011 +0200
@@ -243,38 +243,6 @@
def schema(self):
return self.vreg.schema
- @deprecated('[3.6] select object, then use obj.render()')
- def render(self, __oid, req, __fallback_oid=None, rset=None, initargs=None,
- **kwargs):
- """Select object with the given id (`__oid`) then render it. If the
- object isn't selectable, try to select fallback object if
- `__fallback_oid` is specified.
-
- If specified `initargs` is expected to be a dictionnary containing
- arguments that should be given to selection (hence to object's __init__
- as well), but not to render(). Other arbitrary keyword arguments will be
- given to selection *and* to render(), and so should be handled by
- object's call or cell_call method..
- """
- if initargs is None:
- initargs = kwargs
- else:
- initargs.update(kwargs)
- try:
- obj = self.select(__oid, req, rset=rset, **initargs)
- except NoSelectableObject:
- if __fallback_oid is None:
- raise
- obj = self.select(__fallback_oid, req, rset=rset, **initargs)
- return obj.render(**kwargs)
-
- @deprecated('[3.6] use select_or_none and test for obj.cw_propval("visible")')
- def select_vobject(self, oid, *args, **kwargs):
- selected = self.select_or_none(oid, *args, **kwargs)
- if selected and selected.cw_propval('visible'):
- return selected
- return None
-
def poss_visible_objects(self, *args, **kwargs):
"""return an ordered list of possible app objects in a given registry,
supposing they support the 'visible' and 'order' properties (as most
@@ -283,7 +251,6 @@
return sorted([x for x in self.possible_objects(*args, **kwargs)
if x.cw_propval('visible')],
key=lambda x: x.cw_propval('order'))
- possible_vobjects = deprecated('[3.6] use poss_visible_objects()')(poss_visible_objects)
VRegistry.REGISTRY_FACTORY[None] = CWRegistry
@@ -816,40 +783,6 @@
self.warning('%s (you should probably delete that property '
'from the database)', ex)
- # deprecated code ####################################################
-
- @deprecated('[3.4] use vreg["etypes"].etype_class(etype)')
- def etype_class(self, etype):
- return self["etypes"].etype_class(etype)
-
- @deprecated('[3.4] use vreg["views"].main_template(*args, **kwargs)')
- def main_template(self, req, oid='main-template', **context):
- return self["views"].main_template(req, oid, **context)
-
- @deprecated('[3.4] use vreg[registry].possible_vobjects(*args, **kwargs)')
- def possible_vobjects(self, registry, *args, **kwargs):
- return self[registry].possible_vobjects(*args, **kwargs)
-
- @deprecated('[3.4] use vreg["actions"].possible_actions(*args, **kwargs)')
- def possible_actions(self, req, rset=None, **kwargs):
- return self["actions"].possible_actions(req, rest=rset, **kwargs)
-
- @deprecated('[3.4] use vreg["ctxcomponents"].select_object(...)')
- def select_box(self, oid, *args, **kwargs):
- return self['boxes'].select_object(oid, *args, **kwargs)
-
- @deprecated('[3.4] use vreg["components"].select_object(...)')
- def select_component(self, cid, *args, **kwargs):
- return self['components'].select_object(cid, *args, **kwargs)
-
- @deprecated('[3.4] use vreg["actions"].select_object(...)')
- def select_action(self, oid, *args, **kwargs):
- return self['actions'].select_object(oid, *args, **kwargs)
-
- @deprecated('[3.4] use vreg["views"].select(...)')
- def select_view(self, __vid, req, rset=None, **kwargs):
- return self['views'].select(__vid, req, rset=rset, **kwargs)
-
# XXX unify with yams.constraints.BASE_CONVERTERS?
YAMS_TO_PY = BASE_CONVERTERS.copy()
--- a/devtools/devctl.py Fri Oct 21 14:32:18 2011 +0200
+++ b/devtools/devctl.py Fri Oct 21 14:32:37 2011 +0200
@@ -263,10 +263,7 @@
objid = '%s_%s' % (reg, obj.__regid__)
if objid in done:
break
- try: # XXX < 3.6 bw compat
- pdefs = obj.property_defs
- except AttributeError:
- pdefs = getattr(obj, 'cw_property_defs', {})
+ pdefs = getattr(obj, 'cw_property_defs', {})
if pdefs:
yield objid
done.add(objid)
--- a/devtools/testlib.py Fri Oct 21 14:32:18 2011 +0200
+++ b/devtools/testlib.py Fri Oct 21 14:32:37 2011 +0200
@@ -904,12 +904,6 @@
DeprecationWarning, stacklevel=2)
return self.execute(rql, args, req=req).get_entity(0, 0)
- @deprecated('[3.6] use self.request().create_entity(...)')
- def add_entity(self, etype, req=None, **kwargs):
- if req is None:
- req = self.request()
- return req.create_entity(etype, **kwargs)
-
# auto-populating test classes and utilities ###################################
--- a/entities/lib.py Fri Oct 21 14:32:18 2011 +0200
+++ b/entities/lib.py Fri Oct 21 14:32:37 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -55,10 +55,6 @@
def prefered(self):
return self.prefered_form and self.prefered_form[0] or self
- @deprecated('[3.6] use .prefered')
- def canonical_form(self):
- return self.prefered_form and self.prefered_form[0] or self
-
def related_emails(self, skipeids=None):
# XXX move to eemail
# check email relations are in the schema first
--- a/entities/wfobjs.py Fri Oct 21 14:32:18 2011 +0200
+++ b/entities/wfobjs.py Fri Oct 21 14:32:37 2011 +0200
@@ -251,11 +251,6 @@
'T condition X WHERE T eid %(x)s', kwargs)
# XXX clear caches?
- @deprecated('[3.6.1] use set_permission')
- def set_transition_permissions(self, requiredgroups=(), conditions=(),
- reset=True):
- return self.set_permissions(requiredgroups, conditions, reset)
-
class Transition(BaseTransition):
"""customized class for Transition entities"""
@@ -386,10 +381,6 @@
"""
@property
- @deprecated('[3.5] use printable_state')
- def displayable_state(self):
- return self._cw._(self.state)
- @property
@deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').main_workflow")
def main_workflow(self):
return self.cw_adapt_to('IWorkflowable').main_workflow
@@ -414,14 +405,6 @@
def workflow_history(self):
return self.cw_adapt_to('IWorkflowable').workflow_history
- @deprecated('[3.5] get transition from current workflow and use its may_be_fired method')
- def can_pass_transition(self, trname):
- """return the Transition instance if the current user can fire the
- transition with the given name, else None
- """
- tr = self.current_workflow and self.current_workflow.transition_by_name(trname)
- if tr and tr.may_be_fired(self.eid):
- return tr
@deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').cwetype_workflow()")
def cwetype_workflow(self):
return self.cw_adapt_to('IWorkflowable').main_workflow()
@@ -607,11 +590,7 @@
if hasattr(statename, 'eid'):
stateeid = statename.eid
else:
- if not isinstance(statename, basestring):
- warn('[3.5] give a state name', DeprecationWarning, stacklevel=2)
- state = self.current_workflow.state_by_eid(statename)
- else:
- state = self.current_workflow.state_by_name(statename)
+ state = self.current_workflow.state_by_name(statename)
if state is None:
raise WorkflowException('not a %s state: %s' % (self.__regid__,
statename))
--- a/entity.py Fri Oct 21 14:32:18 2011 +0200
+++ b/entity.py Fri Oct 21 14:32:37 2011 +0200
@@ -623,12 +623,7 @@
kwargs['base_url'] = sourcemeta['base-url']
use_ext_id = True
if method in (None, 'view'):
- try:
- kwargs['_restpath'] = self.rest_path(use_ext_id)
- except TypeError:
- warn('[3.4] %s: rest_path() now take use_ext_eid argument, '
- 'please update' % self.__regid__, DeprecationWarning)
- kwargs['_restpath'] = self.rest_path()
+ kwargs['_restpath'] = self.rest_path(use_ext_id)
else:
kwargs['rql'] = 'Any X WHERE X eid %s' % self.eid
return self._cw.build_url(method, **kwargs)
--- a/req.py Fri Oct 21 14:32:18 2011 +0200
+++ b/req.py Fri Oct 21 14:32:37 2011 +0200
@@ -424,13 +424,3 @@
def describe(self, eid, asdict=False):
"""return a tuple (type, sourceuri, extid) for the entity with id <eid>"""
raise NotImplementedError
-
- @property
- @deprecated('[3.6] use _cw.vreg.config')
- def config(self):
- return self.vreg.config
-
- @property
- @deprecated('[3.6] use _cw.vreg.schema')
- def schema(self):
- return self.vreg.schema
--- a/schema.py Fri Oct 21 14:32:18 2011 +0200
+++ b/schema.py Fri Oct 21 14:32:37 2011 +0200
@@ -175,8 +175,6 @@
else:
return unicode(req._(key))
-__builtins__['display_name'] = deprecated('[3.4] display_name should be imported from cubicweb.schema')(display_name)
-
# Schema objects definition ###################################################
@@ -931,9 +929,6 @@
@classmethod
def deserialize(cls, value):
- # XXX < 3.5.10 bw compat
- if not value.startswith(';'):
- return cls(value)
_, mainvars, expression = value.split(';', 2)
return cls(expression, mainvars)
@@ -973,7 +968,7 @@
def repo_check(self, session, eidfrom, rtype, eidto):
"""raise ValidationError if the relation doesn't satisfy the constraint
"""
- pass # this is a vocabulary constraint, not enforce
+ pass # this is a vocabulary constraint, not enforced
class RepoEnforcedRQLConstraintMixIn(object):
@@ -988,9 +983,6 @@
self.msg or '')
def deserialize(cls, value):
- # XXX < 3.5.10 bw compat
- if not value.startswith(';'):
- return cls(value)
value, msg = value.split('\n', 1)
_, mainvars, expression = value.split(';', 2)
return cls(expression, mainvars, msg)
--- a/selectors.py Fri Oct 21 14:32:18 2011 +0200
+++ b/selectors.py Fri Oct 21 14:32:37 2011 +0200
@@ -1027,12 +1027,7 @@
def complete(self, cls):
self.rtype = cls.rtype
self.role = role(cls)
- self.target_etype = getattr(cls, 'etype', None)
- if self.target_etype is not None:
- warn('[3.6] please rename etype to target_etype on %s' % cls,
- DeprecationWarning)
- else:
- self.target_etype = getattr(cls, 'target_etype', None)
+ self.target_etype = getattr(cls, 'target_etype', None)
class has_related_entities(EntitySelector):
@@ -1084,12 +1079,7 @@
def complete(self, cls):
self.rtype = cls.rtype
self.role = role(cls)
- self.target_etype = getattr(cls, 'etype', None)
- if self.target_etype is not None:
- warn('[3.6] please rename etype to target_etype on %s' % cls,
- DeprecationWarning)
- else:
- self.target_etype = getattr(cls, 'target_etype', None)
+ self.target_etype = getattr(cls, 'target_etype', None)
class has_permission(EntitySelector):
--- a/server/hook.py Fri Oct 21 14:32:18 2011 +0200
+++ b/server/hook.py Fri Oct 21 14:32:37 2011 +0200
@@ -291,12 +291,6 @@
class HooksRegistry(CWRegistry):
- def initialization_completed(self):
- for appobjects in self.values():
- for cls in appobjects:
- if not cls.enabled:
- warn('[3.6] %s: enabled is deprecated' % classid(cls))
- self.unregister(cls)
def register(self, obj, **kwargs):
obj.check_events()
@@ -534,8 +528,6 @@
events = None
category = None
order = 0
- # XXX deprecated
- enabled = True
# stop pylint from complaining about missing attributes in Hooks classes
eidfrom = eidto = entity = rtype = repo = None
@@ -567,28 +559,6 @@
cls.check_events()
return ['%s_hooks' % ev for ev in cls.events]
- @classproperty
- def __regid__(cls):
- warn('[3.6] %s: please specify an id for your hook' % classid(cls),
- DeprecationWarning)
- return str(id(cls))
-
- @classmethod
- def __registered__(cls, reg):
- super(Hook, cls).__registered__(reg)
- if getattr(cls, 'accepts', None):
- warn('[3.6] %s: accepts is deprecated, define proper __select__'
- % classid(cls), DeprecationWarning)
- rtypes = []
- for ertype in cls.accepts: # pylint: disable=E1101
- if ertype.islower():
- rtypes.append(ertype)
- else:
- cls.__select__ = cls.__select__ & is_instance(ertype)
- if rtypes:
- cls.__select__ = cls.__select__ & match_rtype(*rtypes)
- return cls
-
known_args = set(('entity', 'rtype', 'eidfrom', 'eidto', 'repo', 'timestamp'))
def __init__(self, req, event, **kwargs):
for arg in self.known_args:
@@ -597,22 +567,6 @@
super(Hook, self).__init__(req, **kwargs)
self.event = event
- def __call__(self):
- if hasattr(self, 'call'):
- warn('[3.6] %s: call is deprecated, implement __call__'
- % classid(self.__class__), DeprecationWarning)
- # pylint: disable=E1101
- if self.event.endswith('_relation'):
- self.call(self._cw, self.eidfrom, self.rtype, self.eidto)
- elif 'delete' in self.event:
- self.call(self._cw, self.entity.eid)
- elif self.event.startswith('server_'):
- self.call(self.repo)
- elif self.event.startswith('session_'):
- self.call(self._cw)
- else:
- self.call(self._cw, self.entity)
-
set_log_methods(Hook, getLogger('cubicweb.hook'))
@@ -831,26 +785,6 @@
def postcommit_event(self):
"""the observed connections set has committed"""
- @property
- @deprecated('[3.6] use self.session.user')
- def user(self):
- return self.session.user
-
- @property
- @deprecated('[3.6] use self.session.repo')
- def repo(self):
- return self.session.repo
-
- @property
- @deprecated('[3.6] use self.session.vreg.schema')
- def schema(self):
- return self.session.repo.schema
-
- @property
- @deprecated('[3.6] use self.session.vreg.config')
- def config(self):
- return self.session.repo.config
-
# these are overridden by set_log_methods below
# only defining here to prevent pylint from complaining
info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
--- a/server/hookhelper.py Fri Oct 21 14:32:18 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""helper functions for application hooks
-
-"""
-__docformat__ = "restructuredtext en"
-
-from logilab.common.deprecation import deprecated, class_moved
-
-from cubicweb.server import hook
-
-@deprecated('[3.6] entity_oldnewvalue should be imported from cw.server.hook')
-def entity_oldnewvalue(entity, attr):
- return hook.entity_oldnewvalue(entity, attr)
-
-@deprecated('[3.6] entity_name is deprecated, use entity.name')
-def entity_name(session, eid):
- """return the "name" attribute of the entity with the given eid"""
- return session.entity_from_eid(eid).name
-
-@deprecated('[3.6] rproperty is deprecated, use session.schema_rproperty')
-def rproperty(session, rtype, eidfrom, eidto, rprop):
- return session.rproperty(rtype, eidfrom, eidto, rprop)
-
-SendMailOp = class_moved(hook.SendMailOp)
--- a/server/migractions.py Fri Oct 21 14:32:18 2011 +0200
+++ b/server/migractions.py Fri Oct 21 14:32:37 2011 +0200
@@ -333,7 +333,6 @@
context = super(ServerMigrationHelper, self)._create_context()
context.update({'commit': self.checkpoint,
'rollback': self.rollback,
- 'checkpoint': deprecated('[3.6] use commit')(self.checkpoint),
'sql': self.sqlexec,
'rql': self.rqlexec,
'rqliter': self.rqliter,
@@ -342,9 +341,6 @@
'fsschema': self.fs_schema,
'session' : self.session,
'repo' : self.repo,
- '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
@@ -397,14 +393,7 @@
directory = osp.join(CW_SOFTWARE_ROOT, 'schemas')
else:
directory = self.config.cube_dir(cube)
- sql_scripts = []
- for fpath in glob(osp.join(directory, '*.sql.%s' % driver)):
- newname = osp.basename(fpath).replace('.sql.%s' % driver,
- '.%s.sql' % driver)
- warn('[3.5.6] rename %s into %s' % (fpath, newname),
- DeprecationWarning)
- sql_scripts.append(fpath)
- sql_scripts += glob(osp.join(directory, '*.%s.sql' % driver))
+ sql_scripts = glob(osp.join(directory, '*.%s.sql' % driver))
for fpath in sql_scripts:
print '-> installing', fpath
try:
@@ -1249,10 +1238,6 @@
if commit:
self.commit()
- @deprecated('[3.2] 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)
-
# Workflows handling ######################################################
def cmd_make_workflowable(self, etype):
@@ -1308,62 +1293,6 @@
{'et': etype})
return rset.get_entity(0, 0)
- # XXX remove once cmd_add_[state|transition] are removed
- def _get_or_create_wf(self, etypes):
- if not isinstance(etypes, (list, tuple)):
- etypes = (etypes,)
- rset = self.rqlexec('Workflow X WHERE X workflow_of ET, ET name %(et)s',
- {'et': etypes[0]})
- if rset:
- 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',
- 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)
- """
- wf = self._get_or_create_wf(stateof)
- state = wf.add_state(name, initial, **kwargs)
- if commit:
- self.commit()
- return state.eid
-
- @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
- entity type(s), from one or more state and to a single state
- """
- wf = self._get_or_create_wf(transitionof)
- tr = wf.add_transition(name, fromstates, tostate, requiredgroups,
- conditions, **kwargs)
- if commit:
- self.commit()
- return tr.eid
-
- @deprecated('[3.5] use Transition.set_transition_permissions method',
- stacklevel=3)
- def cmd_set_transition_permissions(self, treid,
- requiredgroups=(), conditions=(),
- reset=True, commit=False):
- """set or add (if `reset` is False) groups and conditions for a
- transition
- """
- tr = self._cw.entity_from_eid(treid)
- tr.set_transition_permissions(requiredgroups, conditions, reset)
- if commit:
- self.commit()
-
- @deprecated('[3.5] use iworkflowable.fire_transition("transition") or '
- 'iworkflowable.change_state("state")', stacklevel=3)
- def cmd_set_state(self, eid, statename, commit=False):
- self._cw.entity_from_eid(eid).cw_adapt_to('IWorkflowable').change_state(statename)
- if commit:
- self.commit()
-
# CWProperty handling ######################################################
def cmd_property_value(self, pkey):
@@ -1458,11 +1387,6 @@
from cubicweb.server.checkintegrity import reindex_entities
reindex_entities(self.repo.schema, self.session, etypes=etypes)
- @deprecated('[3.5] use create_entity', stacklevel=3)
- def cmd_add_entity(self, etype, *args, **kwargs):
- """add a new entity of the given type"""
- return self.cmd_create_entity(etype, *args, **kwargs).eid
-
@contextmanager
def cmd_dropped_constraints(self, etype, attrname, cstrtype=None,
droprequired=False):
--- a/server/session.py Fri Oct 21 14:32:18 2011 +0200
+++ b/server/session.py Fri Oct 21 14:32:37 2011 +0200
@@ -1254,31 +1254,6 @@
"""return the original parent session if any, else self"""
return self
- @property
- @deprecated("[3.6] use session.vreg.schema")
- def schema(self):
- return self.repo.schema
-
- @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('[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
- return self.transaction_data.setdefault(key, default)
- if pop:
- return self.transaction_data.pop(key, default)
- else:
- return self.transaction_data.get(key, default)
-
- @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)
-
# these are overridden by set_log_methods below
# only defining here to prevent pylint from complaining
info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
--- a/utils.py Fri Oct 21 14:32:18 2011 +0200
+++ b/utils.py Fri Oct 21 14:32:37 2011 +0200
@@ -548,15 +548,6 @@
dict1.update(dict2)
return dict1
-from logilab.common import date
-_THIS_MOD_NS = globals()
-for funcname in ('date_range', 'todate', 'todatetime', 'datetime2ticks',
- 'days_in_month', 'days_in_year', 'previous_month',
- 'next_month', 'first_day', 'last_day',
- 'strptime'):
- msg = '[3.6] %s has been moved to logilab.common.date' % funcname
- _THIS_MOD_NS[funcname] = deprecated(msg)(getattr(date, funcname))
-
logger = getLogger('cubicweb.utils')
--- a/view.py Fri Oct 21 14:32:18 2011 +0200
+++ b/view.py Fri Oct 21 14:32:37 2011 +0200
@@ -115,19 +115,7 @@
binary = False
add_to_breadcrumbs = True
category = 'view'
-
- @property
- @deprecated('[3.6] need_navigation is deprecated, use .paginable')
- def need_navigation(self):
- return True
-
- @property
- def paginable(self):
- if not isinstance(self.__class__.need_navigation, property):
- warn('[3.6] %s.need_navigation is deprecated, use .paginable'
- % self.__class__, DeprecationWarning)
- return self.need_navigation
- return True
+ paginable = True
def __init__(self, req=None, rset=None, **kwargs):
super(View, self).__init__(req, rset=rset, **kwargs)
@@ -195,8 +183,6 @@
template.expand(context, output)
return output.getvalue()
- dispatch = deprecated('[3.4] .dispatch is deprecated, use .render')(render)
-
# should default .call() method add a <div classs="section"> around each
# rset item
add_div_section = True
@@ -284,9 +270,6 @@
"""
self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
- # XXX Template bw compat
- template = deprecated('[3.4] .template is deprecated, use .view')(wview)
-
def whead(self, data):
self._cw.html_headers.write(data)
--- a/vregistry.py Fri Oct 21 14:32:18 2011 +0200
+++ b/vregistry.py Fri Oct 21 14:32:37 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -197,8 +197,6 @@
return self.select(__oid, *args, **kwargs)
except (NoSelectableObject, ObjectNotFound):
return None
- select_object = deprecated('[3.6] use select_or_none instead of select_object'
- )(select_or_none)
def possible_objects(self, *args, **kwargs):
"""return an iterator on possible objects in this registry for the given
@@ -218,9 +216,6 @@
it's costly when searching appobjects using `possible_objects`
(e.g. searching for hooks).
"""
- if len(args) > 1:
- warn('[3.5] only the request param can not be named when calling select*',
- DeprecationWarning, stacklevel=3)
score, winners = 0, None
for appobject in appobjects:
appobjectscore = appobject.__select__(appobject, *args, **kwargs)
@@ -240,8 +235,6 @@
# return the result of calling the appobject
return winners[0](*args, **kwargs)
- select_best = deprecated('[3.6] select_best is now private')(_select_best)
-
# these are overridden by set_log_methods below
# only defining here to prevent pylint from complaining
info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
@@ -282,41 +275,6 @@
except KeyError:
raise RegistryNotFound(name), None, sys.exc_info()[-1]
- # dynamic selection methods ################################################
-
- @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>
-
- raise `ObjectNotFound` if not object with id <oid> in <registry>
- raise `AssertionError` if there is more than one object there
- """
- return self[registry].object_by_id(oid)
-
- @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
-
- raise `ObjectNotFound` if not object with id <oid> in <registry>
- raise `NoSelectableObject` if not object apply
- """
- return self[registry].select(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('[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
- """
- return self[registry].possible_objects(*args, **kwargs)
-
# methods for explicit (un)registration ###################################
# default class, when no specific class set
@@ -540,31 +498,4 @@
from cubicweb.appobject import objectify_selector, AndSelector, OrSelector, Selector
-objectify_selector = deprecated('[3.4] objectify_selector has been moved to appobject module')(objectify_selector)
-
Selector = class_moved(Selector)
-
-@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
- will be the sum of each selector'score
- """
- assert selectors
- # XXX do we need to create the AndSelector here, a tuple might be enough
- selector = AndSelector(*selectors)
- if 'name' in kwargs:
- selector.__name__ = kwargs['name']
- return selector
-
-@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
- will be the first non-zero selector score
- """
- assert selectors
- selector = OrSelector(*selectors)
- if 'name' in kwargs:
- selector.__name__ = kwargs['name']
- return selector
--- a/web/__init__.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/__init__.py Fri Oct 21 14:32:37 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -62,26 +62,3 @@
except TypeError:
return json_dumps(repr(value))
return newfunc
-
-@deprecated('[3.4] use req.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')
- "javascript: replacePageChunk('foo', 'Person%20P');"
- >>> ajax_replace_url('foo', 'Person P', 'oneline')
- "javascript: replacePageChunk('foo', 'Person%20P', 'oneline');"
- >>> ajax_replace_url('foo', 'Person P', 'oneline', name='bar', age=12)
- "javascript: replacePageChunk('foo', 'Person%20P', 'oneline', {'age':12, 'name':'bar'});"
- >>> ajax_replace_url('foo', 'Person P', name='bar', age=12)
- "javascript: replacePageChunk('foo', 'Person%20P', 'null', {'age':12, 'name':'bar'});"
- """
- params = [repr(nodeid), repr(urlquote(rql))]
- if extraparams and not vid:
- params.append("'null'")
- elif vid:
- params.append(repr(vid))
- if extraparams:
- params.append(json_dumps(extraparams))
- if swap:
- params.append('true')
- return "javascript: replacePageChunk(%s);" % ', '.join(params)
--- a/web/action.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/action.py Fri Oct 21 14:32:37 2011 +0200
@@ -137,11 +137,7 @@
target_etype = rtype = None
def url(self):
- try:
- # deprecated in 3.6, already warned by the selector
- ttype = self.etype # pylint: disable=E1101
- except AttributeError:
- ttype = self.target_etype
+ ttype = self.target_etype
entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
linkto = '%s:%s:%s' % (self.rtype, entity.eid, target(self))
return self._cw.vreg["etypes"].etype_class(ttype).cw_create_url(self._cw,
--- a/web/application.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/application.py Fri Oct 21 14:32:37 2011 +0200
@@ -124,8 +124,7 @@
class AbstractAuthenticationManager(component.Component):
"""authenticate user associated to a request and check session validity"""
- id = 'authmanager'
- vreg = None # XXX necessary until property for deprecation warning is on appobject
+ __regid__ = 'authmanager'
def __init__(self, vreg):
self.vreg = vreg
@@ -333,13 +332,6 @@
except Exception:
self.exception('error while logging queries')
- @deprecated("[3.4] use vreg['controllers'].select(...)")
- def select_controller(self, oid, req):
- try:
- return self.vreg['controllers'].select(oid, req=req, appli=self)
- except NoSelectableObject:
- raise Unauthorized(req._('not authorized'))
-
def main_publish(self, path, req):
"""method called by the main publisher to process <path>
--- a/web/component.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/component.py Fri Oct 21 14:32:37 2011 +0200
@@ -732,11 +732,3 @@
self.w(u'<h4>%s</h4>\n' % self._cw._(self.title).capitalize())
self.wview(self.vid, rset)
self.w(u'</div>')
-
-
-
-VComponent = class_renamed('VComponent', Component,
- '[3.2] VComponent is deprecated, use Component')
-SingletonVComponent = class_renamed('SingletonVComponent', Component,
- '[3.2] SingletonVComponent is deprecated, use '
- 'Component and explicit registration control')
--- a/web/form.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/form.py Fri Oct 21 14:32:37 2011 +0200
@@ -223,11 +223,6 @@
# deleting validation errors here breaks form reloading (errors are
# no more available), they have to be deleted by application's publish
# method on successful commit
- if hasattr(self, '_form_previous_values'):
- # XXX behaviour changed in 3.6.1, warn
- warn('[3.6.1] restore_previous_post already called, remove this call',
- DeprecationWarning, stacklevel=2)
- return
forminfo = self._cw.session.data.pop(sessionkey, None)
if forminfo:
self._form_previous_values = forminfo['values']
@@ -262,11 +257,3 @@
def remaining_errors(self):
return sorted(self.form_valerror.errors.items())
- @deprecated('[3.6] use form.field_error and/or new renderer.render_error method')
- def form_field_error(self, field):
- """return validation error for widget's field, if any"""
- err = self.field_error(field)
- if err:
- return u'<span class="error">%s</span>' % err
- return u''
-
--- a/web/formfields.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/formfields.py Fri Oct 21 14:32:37 2011 +0200
@@ -203,10 +203,6 @@
def __init__(self, name=None, label=_MARKER, widget=None, **kwargs):
for key, val in kwargs.items():
- if key == 'initial':
- warn('[3.6] use value instead of initial', DeprecationWarning,
- stacklevel=3)
- key = 'value'
assert hasattr(self.__class__, key) and not key[0] == '_', key
setattr(self, key, val)
self.name = name
@@ -358,10 +354,6 @@
return self.value(form)
return self.value
formattr = '%s_%s_default' % (self.role, self.name)
- if hasattr(form, formattr):
- warn('[3.6] %s.%s deprecated, use field.value' % (
- form.__class__.__name__, formattr), DeprecationWarning)
- return getattr(form, formattr)()
if self.eidparam and self.role is not None:
if form._cw.vreg.schema.rschema(self.name).final:
return form.edited_entity.e_schema.default(self.name)
@@ -393,19 +385,8 @@
# pylint: disable=E1102
if getattr(self.choices, 'im_self', None) is self:
vocab = self.choices(form=form, **kwargs)
- elif support_args(self.choices, 'form', 'field'):
+ else:
vocab = self.choices(form=form, field=self, **kwargs)
- else:
- try:
- vocab = self.choices(form=form, **kwargs)
- warn('[3.6] %s: choices should now take '
- 'the form and field as named arguments' % self,
- DeprecationWarning)
- except TypeError:
- warn('[3.3] %s: choices should now take '
- 'the form and field as named arguments' % self,
- DeprecationWarning)
- vocab = self.choices(req=form._cw, **kwargs)
else:
vocab = self.choices
if vocab and not isinstance(vocab[0], (list, tuple)):
@@ -1047,17 +1028,11 @@
linkedto = self.relvoc_linkedto(form)
if linkedto:
return linkedto
+ # it isn't, search more vocabulary
vocab = self.relvoc_init(form)
else:
vocab = []
- # it isn't, check if the entity provides a method to get correct values
- method = '%s_%s_vocabulary' % (self.role, self.name)
- try:
- vocab += getattr(form, method)(self.name, limit)
- warn('[3.6] found %s on %s, should override field.choices instead (need tweaks)'
- % (method, form), DeprecationWarning)
- except AttributeError:
- vocab += self.relvoc_unrelated(form, limit)
+ vocab += self.relvoc_unrelated(form, limit)
if self.sort:
vocab = vocab_sort(vocab)
return vocab
--- a/web/formwidgets.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/formwidgets.py Fri Oct 21 14:32:37 2011 +0200
@@ -285,13 +285,6 @@
def values_and_attributes(self, form, field):
return self.values(form, field), self.attributes(form, field)
- @deprecated('[3.6] use values_and_attributes')
- def _render_attrs(self, form, field):
- """return html tag name, attributes and a list of values for the field
- """
- values, attrs = self.values_and_attributes(form, field)
- return field.input_name(form, self.suffix), values, attrs
-
class Input(FieldWidget):
"""abstract widget class for <input> tag based widgets"""
@@ -734,14 +727,7 @@
def __init__(self, *args, **kwargs):
self.autocomplete_settings = kwargs.pop('autocomplete_settings',
self.default_settings)
- try:
- self.autocomplete_initfunc = kwargs.pop('autocomplete_initfunc')
- except KeyError:
- warn('[3.6] use autocomplete_initfunc argument of %s constructor '
- 'instead of relying on autocomplete_initfuncs dictionary on '
- 'the entity class' % self.__class__.__name__,
- DeprecationWarning)
- self.autocomplete_initfunc = None
+ self.autocomplete_initfunc = kwargs.pop('autocomplete_initfunc')
super(AutoCompletionWidget, self).__init__(*args, **kwargs)
def values(self, form, field):
@@ -763,11 +749,7 @@
return super(AutoCompletionWidget, self)._render(form, field, renderer)
def _get_url(self, entity, field):
- if self.autocomplete_initfunc is None:
- # XXX for bw compat
- fname = entity.autocomplete_initfuncs[field.name]
- else:
- fname = self.autocomplete_initfunc
+ fname = self.autocomplete_initfunc
return entity._cw.build_url('json', fname=fname, mode='remote',
pageid=entity._cw.pageid)
@@ -778,12 +760,7 @@
wdgtype = 'StaticFileSuggestField'
def _get_url(self, entity, field):
- if self.autocomplete_initfunc is None:
- # XXX for bw compat
- fname = entity.autocomplete_initfuncs[field.name]
- else:
- fname = self.autocomplete_initfunc
- return entity._cw.data_url(fname)
+ return entity._cw.data_url(self.autocomplete_initfunc)
class RestrictedAutoCompletionWidget(AutoCompletionWidget):
--- a/web/request.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/request.py Fri Oct 21 14:32:37 2011 +0200
@@ -405,12 +405,9 @@
cbname = build_cb_uid(func.__name__)
def _cb(req):
try:
- ret = func(req, *args)
- except TypeError:
- warn('[3.2] user callback should now take request as argument')
- ret = func(*args)
- self.unregister_callback(self.pageid, cbname)
- return ret
+ return func(req, *args)
+ finally:
+ self.unregister_callback(self.pageid, cbname)
self.set_page_data(cbname, _cb)
return cbname
@@ -887,12 +884,6 @@
raise
return default
- @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
- self.parse_accept_header('Accept-Language')]
-
## HTTP-accept parsers / utilies ##############################################
--- a/web/uicfg.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/uicfg.py Fri Oct 21 14:32:37 2011 +0200
@@ -243,19 +243,11 @@
for formtype, section in sectdict.iteritems():
formsections.add('%s_%s' % (formtype, section))
- def tag_relation(self, key, formtype, section=None):
+ def tag_relation(self, key, formtype, section):
if isinstance(formtype, tuple):
for ftype in formtype:
self.tag_relation(key, ftype, section)
return
- if section is None:
- tag = formtype
- for formtype, section in self.bw_tag_map[tag].iteritems():
- warn('[3.6] add tag to autoform section by specifying form '
- 'type and tag. Replace %s by formtype="%s", section="%s"'
- % (tag, formtype, section), DeprecationWarning,
- stacklevel=3)
- self.tag_relation(key, formtype, section)
assert formtype in self._allowed_form_types, \
'formtype should be in (%s), not %s' % (
','.join(self._allowed_form_types), formtype)
@@ -450,20 +442,3 @@
actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu',
init_actionbox_appearsin_addmenu)
-
-
-# deprecated ###################################################################
-
-class AutoformIsInlined(RelationTags):
- """XXX for < 3.6 bw compat"""
- def tag_relation(self, key, tag):
- warn('autoform_is_inlined is deprecated, use autoform_section '
- 'with formtype="main", section="inlined"',
- DeprecationWarning, stacklevel=3)
- section = tag and 'inlined' or 'hidden'
- autoform_section.tag_relation(key, 'main', section)
-
-# inlined view flag for non final relations: when True for an entry, the
-# entity(ies) at the other end of the relation will be editable from the
-# form of the edited entity
-autoform_is_inlined = AutoformIsInlined('autoform_is_inlined')
--- a/web/views/actions.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/actions.py Fri Oct 21 14:32:37 2011 +0200
@@ -50,12 +50,7 @@
entity=entity, mainform=False)
for dummy in form.editable_relations():
return 1
- try:
- editableattrs = form.editable_attributes(strict=True)
- except TypeError:
- warn('[3.6] %s: editable_attributes now take strict=False as '
- 'optional argument', DeprecationWarning)
- editableattrs = form.editable_attributes()
+ editableattrs = form.editable_attributes(strict=True)
for rschema, role in editableattrs:
return 1
return 0
--- a/web/views/autoform.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/autoform.py Fri Oct 21 14:32:37 2011 +0200
@@ -758,14 +758,7 @@
# autoform specific fields #################################################
def _generic_relations_field(self):
- try:
- # pylint: disable=E1101
- srels_by_cat = self.srelations_by_category('generic', 'add', strict=True)
- warn('[3.6] %s: srelations_by_category is deprecated, use uicfg or '
- 'override editable_relations instead' % classid(self),
- DeprecationWarning)
- except AttributeError:
- srels_by_cat = self.editable_relations()
+ srels_by_cat = self.editable_relations()
if not srels_by_cat:
raise f.FieldNotFound('_cw_generic_field')
fieldset = u'%s :' % self._cw.__('This %s' % self.edited_entity.e_schema)
--- a/web/views/boxes.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/boxes.py Fri Oct 21 14:32:37 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -73,11 +73,6 @@
('moreactions', other_menu),
('addrelated', None)):
for action in actions.get(category, ()):
- if category == 'addrelated':
- warn('[3.5] "addrelated" category is deprecated, use '
- '"moreactions" category w/ "addrelated" submenu',
- DeprecationWarning)
- defaultmenu = self._get_menu('addrelated', _('add'), _('add'))
if action.submenu:
menu = self._get_menu(action.submenu)
else:
--- a/web/views/cwuser.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/cwuser.py Fri Oct 21 14:32:37 2011 +0200
@@ -47,8 +47,8 @@
category = 'mainactions'
def url(self):
- login = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0).login
- return self._cw.build_url('cwuser/%s'%login, vid='propertiesform')
+ user = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+ return user.absolute_url(vid='propertiesform')
class FoafView(EntityView):
--- a/web/views/editcontroller.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/editcontroller.py Fri Oct 21 14:32:37 2011 +0200
@@ -140,12 +140,6 @@
todelete = req.list_form_param('__delete', req.form, pop=True)
if todelete:
autoform.delete_relations(self._cw, todelete)
- if req.form.has_key('__insert'):
- warn('[3.6] stop using __insert, support will be removed',
- DeprecationWarning)
- toinsert = req.list_form_param('__insert', req.form, pop=True)
- if toinsert:
- autoform.insert_relations(self._cw, toinsert)
self._cw.remove_pending_operations()
if self.errors:
errors = dict((f.name, unicode(ex)) for f, ex in self.errors)
--- a/web/views/forms.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/forms.py Fri Oct 21 14:32:37 2011 +0200
@@ -182,7 +182,7 @@
if self.needs_css:
self._cw.add_css(self.needs_css)
- def render(self, formvalues=None, rendervalues=None, renderer=None, **kwargs):
+ def render(self, formvalues=None, renderer=None, **kwargs):
"""Render this form, using the `renderer` given as argument or the
default according to :attr:`form_renderer_id`. The rendered form is
returned as an unicode string.
@@ -191,13 +191,7 @@
considered as field's value.
Extra keyword arguments will be given to renderer's :meth:`render` method.
-
- `rendervalues` is deprecated.
"""
- if rendervalues is not None:
- warn('[3.6] rendervalues argument is deprecated, all named arguments will be given instead',
- DeprecationWarning, stacklevel=2)
- kwargs = rendervalues
w = kwargs.pop('w', None)
if w is None:
warn('[3.10] you should specify "w" to form.render() named arguments',
@@ -306,21 +300,6 @@
raise ValidationError(None, errors)
return processed
- @deprecated('[3.6] use .add_hidden(name, value, **kwargs)')
- def form_add_hidden(self, name, value=None, **kwargs):
- return self.add_hidden(name, value, **kwargs)
-
- @deprecated('[3.6] use .render(formvalues, **rendervalues)')
- def form_render(self, **values):
- """render this form, using the renderer given in args or the default
- FormRenderer()
- """
- self.build_context(values)
- renderer = values.pop('renderer', None)
- if renderer is None:
- renderer = self.default_renderer()
- return renderer.render(self, values)
-
_AFF = uicfg.autoform_field
_AFF_KWARGS = uicfg.autoform_field_kwargs
@@ -459,19 +438,6 @@
def editable_relations(self):
return ()
- @deprecated('[3.6] use cw.web.formfields.RelationField.relvoc_unrelated method')
- def subject_relation_vocabulary(self, rtype, limit=None):
- """defaut vocabulary method for the given relation, looking for
- relation's object entities (i.e. self is the subject)
- """
- field = self.field_by_name(rtype, 'subject')
- return field.relvoc_unrelated(form, limit=None)
-
- @deprecated('[3.6] use cw.web.formfields.relvoc_unrelated method')
- def object_relation_vocabulary(self, rtype, limit=None):
- field = self.field_by_name(rtype, 'object')
- return field.relvoc_unrelated(form, limit=None)
-
class CompositeFormMixIn(object):
__regid__ = 'composite'
--- a/web/views/magicsearch.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/magicsearch.py Fri Oct 21 14:32:37 2011 +0200
@@ -392,14 +392,7 @@
unauthorized = None
for proc in self.processors:
try:
- try:
- return proc.process_query(uquery)
- except TypeError, exc: # cw 3.5 compat
- warn("[3.6] %s.%s.process_query() should now accept uquery "
- "as unique argument, use self._cw instead of req"
- % (proc.__module__, proc.__class__.__name__),
- DeprecationWarning)
- return proc.process_query(uquery, self._cw)
+ return proc.process_query(uquery)
# FIXME : we don't want to catch any exception type here !
except (RQLSyntaxError, BadRQLQuery):
pass
--- a/web/views/navigation.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/navigation.py Fri Oct 21 14:32:37 2011 +0200
@@ -306,15 +306,3 @@
from cubicweb.view import View
View.do_paginate = do_paginate
View.paginate = paginate
-
-
-#@deprecated (see below)
-def limit_rset_using_paged_nav(self, req, rset, w, forcedisplay=False,
- show_all_option=True, page_size=None):
- if not (forcedisplay or req.form.get('__force_display') is not None):
- do_paginate(self, rset, w, show_all_option, page_size)
-
-View.pagination = deprecated('[3.2] .pagination is deprecated, use paginate')(
- limit_rset_using_paged_nav)
-limit_rset_using_paged_nav = deprecated('[3.6] limit_rset_using_paged_nav is deprecated, use do_paginate')(
- limit_rset_using_paged_nav)
--- a/web/views/primary.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/primary.py Fri Oct 21 14:32:37 2011 +0200
@@ -148,9 +148,6 @@
if boxes or hasattr(self, 'render_side_related'):
self.w(u'</td><td>')
self.w(u'<div class="primaryRight">')
- if hasattr(self, 'render_side_related'):
- warn('[3.2] render_side_related is deprecated')
- self.render_side_related(entity, []) # pylint: disable=E1101
self.render_side_boxes(boxes)
self.w(u'</div>')
self.w(u'</td></tr></table>')
@@ -222,17 +219,12 @@
if not hasattr(self, '_render_attribute'):
label = self._rel_label(entity, rschema, role, dispctrl)
self.render_attribute(label, value, table=True)
- elif support_args(self._render_attribute, 'dispctrl'):
+ else:
warn('[3.9] _render_attribute prototype has changed and '
'renamed to render_attribute, please update %s'
% self.__class__, DeprecationWarning)
self._render_attribute(dispctrl, rschema, value, role=role,
table=True)
- else:
- self._render_attribute(rschema, value, role=role, table=True)
- warn('[3.6] _render_attribute prototype has changed and '
- 'renamed to render_attribute, please update %s'
- % self.__class__, DeprecationWarning)
self.w(u'</table>')
def render_attribute(self, label, value, table=False):
@@ -258,17 +250,10 @@
continue
if hasattr(self, '_render_relation'):
# pylint: disable=E1101
- if not support_args(self._render_relation, 'showlabel'):
- self._render_relation(dispctrl, rset, 'autolimited')
- warn('[3.9] _render_relation prototype has changed and has '
- 'been renamed to render_relation, please update %s'
- % self.__class__, DeprecationWarning)
- else:
- self._render_relation(rset, dispctrl, 'autolimited',
- self.show_rel_label)
- warn('[3.6] _render_relation prototype has changed and has '
- 'been renamed to render_relation, please update %s'
- % self.__class__, DeprecationWarning)
+ self._render_relation(dispctrl, rset, 'autolimited')
+ warn('[3.9] _render_relation prototype has changed and has '
+ 'been renamed to render_relation, please update %s'
+ % self.__class__, DeprecationWarning)
continue
vid = dispctrl.get('vid', 'autolimited')
try:
--- a/web/views/startup.py Fri Oct 21 14:32:18 2011 +0200
+++ b/web/views/startup.py Fri Oct 21 14:32:37 2011 +0200
@@ -31,7 +31,7 @@
from cubicweb.view import StartupView
from cubicweb.selectors import match_user_groups, is_instance
from cubicweb.schema import display_name
-from cubicweb.web import ajax_replace_url, uicfg, httpcache
+from cubicweb.web import uicfg, httpcache
class ManageView(StartupView):
""":__regid__: *manage*