Drop most of deprecated code
As in previous changesets, most code has been deprecated since a very
long time. This changeset concerns "core" cubicweb modules
(e.g. "server", "appobjects") for which it's not easy to handle change
atomically.
In cubicweb/server/querier.py, we adjust empty_rset() function as a
result of "rqlst" argument of ResultSet being dropped. (There was no use
of the keyword argument anyways.)
--- a/cubicweb/__init__.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/__init__.py Thu Mar 14 12:08:37 2019 +0100
@@ -30,9 +30,7 @@
import zlib
from six import PY2, binary_type, text_type
-from six.moves import builtins
-from logilab.common.deprecation import deprecated
from logilab.common.logging_ext import set_log_methods
from yams.constraints import BASE_CONVERTERS, BASE_CHECKERS
from yams.schema import role_name as rname
@@ -68,14 +66,6 @@
# '_' is available to mark internationalized string but should not be used to
# do the actual translation
_ = text_type
-if not hasattr(builtins, '_'):
- builtins._ = deprecated("[3.22] Use 'from cubicweb import _'")(_)
-
-
-# convert eid to the right type, raise ValueError if it's not a valid eid
-@deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.')
-def typed_eid(eid):
- return int(eid)
class Binary(BytesIO):
--- a/cubicweb/_exceptions.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/_exceptions.py Thu Mar 14 12:08:37 2019 +0100
@@ -102,14 +102,6 @@
cstr = self.session.find('CWUniqueTogetherConstraint', name=cstrname).one()
return sorted(rtype.name for rtype in cstr.relations)
- @cachedproperty
- def args(self):
- warn('[3.18] UniqueTogetherError.args is deprecated, just use '
- 'the .rtypes accessor.',
- DeprecationWarning)
- # the first argument, etype, is never used and was never garanteed anyway
- return None, self.rtypes
-
class ViolatedConstraint(RepositoryError):
def __init__(self, cnx, cstrname):
--- a/cubicweb/appobject.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/appobject.py Thu Mar 14 12:08:37 2019 +0100
@@ -31,26 +31,10 @@
from logging import getLogger
-from logilab.common.deprecation import deprecated, class_renamed
from logilab.common.logging_ext import set_log_methods
-# first line imports for bw compat
-from logilab.common.registry import (objectify_predicate, traced_selection, Predicate,
- RegistrableObject, yes)
-
+from logilab.common.registry import RegistrableObject, yes
-objectify_selector = deprecated('[3.15] objectify_selector has been '
- 'renamed to objectify_predicates in '
- 'logilab.common.registry')(objectify_predicate)
-traced_selection = deprecated('[3.15] traced_selection has been '
- 'moved to logilab.common.registry')(traced_selection)
-Selector = class_renamed('Selector', Predicate,
- '[3.15] Selector has been renamed to Predicate '
- 'in logilab.common.registry')
-
-@deprecated('[3.15] lltrace decorator can now be removed')
-def lltrace(func):
- return func
# the base class for all appobjects ############################################
@@ -156,6 +140,3 @@
info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
set_log_methods(AppObject, getLogger('cubicweb.appobject'))
-
-# defined here to avoid warning on usage on the AppObject class
-yes = deprecated('[3.15] yes has been moved to logilab.common.registry')(yes)
--- a/cubicweb/cwconfig.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/cwconfig.py Thu Mar 14 12:08:37 2019 +0100
@@ -195,7 +195,6 @@
from six import text_type
from logilab.common.decorators import cached, classproperty
-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,
@@ -1358,7 +1357,6 @@
# alias to get a configuration instance from an instance id
instance_configuration = CubicWebConfiguration.config_for
-application_configuration = deprecated('use instance_configuration')(instance_configuration)
_EXT_REGISTERED = False
--- a/cubicweb/cwctl.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/cwctl.py Thu Mar 14 12:08:37 2019 +0100
@@ -873,13 +873,6 @@
'group': 'local'
}),
- ('repo-uri',
- {'short': 'H', 'type' : 'string', 'metavar': '<protocol>://<[host][:port]>',
- 'help': 'URI of the CubicWeb repository to connect to. URI can be \
-a ZMQ URL or inmemory:// (default) use an in-memory repository. THIS OPTION IS DEPRECATED, \
-directly give URI as instance id instead',
- 'group': 'remote'
- }),
)
def _get_mih(self, appid):
@@ -899,12 +892,6 @@
def run(self, args):
appuri = args.pop(0)
- if self.config.repo_uri:
- warn('[3.16] --repo-uri option is deprecated, directly give the URI as instance id',
- DeprecationWarning)
- if urlparse(self.config.repo_uri).scheme == 'inmemory':
- appuri = '%s/%s' % (self.config.repo_uri.rstrip('/'), appuri)
-
mih, shutdown_callback = self._get_mih(appuri)
try:
with mih.cnx:
--- a/cubicweb/devtools/devctl.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/devtools/devctl.py Thu Mar 14 12:08:37 2019 +0100
@@ -30,7 +30,6 @@
from datetime import datetime, date
from os import getcwd, mkdir, chdir, path as osp
import pkg_resources
-from warnings import warn
from pytz import UTC
@@ -481,12 +480,7 @@
print('-> extracting messages:', end=' ')
potfiles = []
# static messages
- if osp.exists(osp.join('i18n', 'entities.pot')):
- warn('entities.pot is deprecated, rename file '
- 'to static-messages.pot (%s)'
- % osp.join('i18n', 'entities.pot'), DeprecationWarning)
- potfiles.append(osp.join('i18n', 'entities.pot'))
- elif osp.exists(osp.join('i18n', 'static-messages.pot')):
+ if osp.exists(osp.join('i18n', 'static-messages.pot')):
potfiles.append(osp.join('i18n', 'static-messages.pot'))
# messages from schema
potfiles.append(self.schemapot())
--- a/cubicweb/entities/test/unittest_wfobjs.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/entities/test/unittest_wfobjs.py Thu Mar 14 12:08:37 2019 +0100
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-from cubicweb import ValidationError
+from cubicweb import _, ValidationError
from cubicweb.devtools.testlib import CubicWebTC
def add_wf(shell, etype, name=None, default=False):
--- a/cubicweb/entity.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/entity.py Thu Mar 14 12:08:37 2019 +0100
@@ -23,7 +23,6 @@
from six.moves import range
from logilab.common.decorators import cached
-from logilab.common.deprecation import deprecated
from logilab.common.registry import yes
from logilab.mtconverter import TransformData, xml_escape
@@ -175,7 +174,6 @@
# class attributes that must be set in class definition
rest_attr = None
fetch_attrs = None
- skip_copy_for = () # bw compat (< 3.14), use cw_skip_copy_for instead
cw_skip_copy_for = [('in_state', 'subject')]
# class attributes set automatically at registration time
e_schema = None
@@ -256,23 +254,11 @@
select.add_sort_var(var, asc=False)
@classmethod
- def fetch_rql(cls, user, restriction=None, fetchattrs=None, mainvar='X',
+ def fetch_rql(cls, user, fetchattrs=None, mainvar='X',
settype=True, ordermethod='fetch_order'):
st = cls.fetch_rqlst(user, mainvar=mainvar, fetchattrs=fetchattrs,
settype=settype, ordermethod=ordermethod)
- rql = st.as_string()
- if restriction:
- # cannot use RQLRewriter API to insert 'X rtype %(x)s' restriction
- warn('[3.14] fetch_rql: use of `restriction` parameter is '
- 'deprecated, please use fetch_rqlst and supply a syntax'
- 'tree with your restriction instead', DeprecationWarning)
- insert = ' WHERE ' + ','.join(restriction)
- if ' WHERE ' in rql:
- select, where = rql.split(' WHERE ', 1)
- rql = select + insert + ',' + where
- else:
- rql += insert
- return rql
+ return st.as_string()
@classmethod
def fetch_rqlst(cls, user, select=None, mainvar='X', fetchattrs=None,
@@ -622,14 +608,6 @@
"""
return self.has_eid() and self._cw_is_saved
- @deprecated('[3.24] cw_metainformation is deprecated')
- @cached
- def cw_metainformation(self):
- source = self.cw_source[0].name
- return {'type': self.cw_etype,
- 'extid': self.cwuri if source != 'system' else None,
- 'source': {'uri': source}}
-
def cw_check_perm(self, action):
self.e_schema.check_perm(self._cw, action, eid=self.eid)
@@ -759,11 +737,6 @@
assert self.has_eid()
execute = self._cw.execute
skip_copy_for = {'subject': set(), 'object': set()}
- for rtype in self.skip_copy_for:
- skip_copy_for['subject'].add(rtype)
- warn('[3.14] skip_copy_for on entity classes (%s) is deprecated, '
- 'use cw_skip_copy_for instead with list of couples (rtype, role)' % self.cw_etype,
- DeprecationWarning)
for rtype, role in self.cw_skip_copy_for:
assert role in ('subject', 'object'), role
skip_copy_for[role].add(rtype)
@@ -1343,29 +1316,6 @@
for rqlexpr in self.e_schema.get_rqlexprs(action):
self._cw.local_perm_cache.pop((rqlexpr.eid, (('x', self.eid),)), None)
- # deprecated stuff #########################################################
-
- @deprecated('[3.16] use cw_set() instead of set_attributes()')
- def set_attributes(self, **kwargs): # XXX cw_set_attributes
- if kwargs:
- self.cw_set(**kwargs)
-
- @deprecated('[3.16] use cw_set() instead of set_relations()')
- def set_relations(self, **kwargs): # XXX cw_set_relations
- """add relations to the given object. To set a relation where this entity
- is the object of the relation, use 'reverse_'<relation> as argument name.
-
- Values may be an entity or eid, a list of entities or eids, or None
- (meaning that all relations of the given type from or to this object
- should be deleted).
- """
- if kwargs:
- self.cw_set(**kwargs)
-
- @deprecated('[3.13] use entity.cw_clear_all_caches()')
- def clear_all_caches(self):
- return self.cw_clear_all_caches()
-
# attribute and relation descriptors ##########################################
@@ -1381,13 +1331,6 @@
return self
return eobj.cw_attr_value(self._attrname)
- @deprecated('[3.10] assign to entity.cw_attr_cache[attr] or entity.cw_edited[attr]')
- def __set__(self, eobj, value):
- if hasattr(eobj, 'cw_edited') and not eobj.cw_edited.saved:
- eobj.cw_edited[self._attrname] = value
- else:
- eobj.cw_attr_cache[self._attrname] = value
-
class Relation(object):
"""descriptor that controls schema relation access"""
--- a/cubicweb/hooks/test/data-computed/schema.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/hooks/test/data-computed/schema.py Thu Mar 14 12:08:37 2019 +0100
@@ -17,6 +17,8 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
from yams.buildobjs import EntityType, String, Int, SubjectRelation, RelationDefinition
+from cubicweb import _
+
THISYEAR = 2014
class Person(EntityType):
--- a/cubicweb/migration.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/migration.py Thu Mar 14 12:08:37 2019 +0100
@@ -35,7 +35,6 @@
from logilab.common.configuration import REQUIRED, read_old_config
from logilab.common.shellutils import ASK
from logilab.common.changelog import Version
-from logilab.common.deprecation import deprecated
from cubicweb import ConfigurationError, ExecutionError
from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
@@ -415,10 +414,6 @@
self.config.add_cubes(newcubes)
return newcubes
- @deprecated('[3.20] use drop_cube() instead of remove_cube()')
- def cmd_remove_cube(self, cube, removedeps=False):
- return self.cmd_drop_cube(cube, removedeps)
-
def cmd_drop_cube(self, cube, removedeps=False):
if removedeps:
toremove = self.config.expand_cubes([cube])
--- a/cubicweb/predicates.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/predicates.py Thu Mar 14 12:08:37 2019 +0100
@@ -27,8 +27,7 @@
from six import string_types, integer_types
from six.moves import range
-from logilab.common.deprecation import deprecated
-from logilab.common.registry import Predicate, objectify_predicate, yes
+from logilab.common.registry import Predicate, objectify_predicate
from yams.schema import BASE_TYPES, role_name
from rql.nodes import Function
@@ -38,8 +37,6 @@
from cubicweb.uilib import eid_param
from cubicweb.schema import split_expression
-yes = deprecated('[3.15] import yes() from use logilab.common.registry')(yes)
-
# abstract predicates / mixin helpers ###########################################
@@ -85,12 +82,7 @@
- `accept_none` is False and some cell in the column has a None value
(this may occurs with outer join)
"""
- def __init__(self, once_is_enough=None, accept_none=True, mode='all'):
- if once_is_enough is not None:
- warn("[3.14] once_is_enough is deprecated, use mode='any'",
- DeprecationWarning, stacklevel=2)
- if once_is_enough:
- mode = 'any'
+ def __init__(self, accept_none=True, mode='all'):
assert mode in ('any', 'all'), 'bad mode %s' % mode
self.once_is_enough = mode == 'any'
self.accept_none = accept_none
@@ -672,8 +664,8 @@
See :class:`~cubicweb.predicates.EntityPredicate` documentation for entity
lookup / score rules according to the input context.
"""
- def __init__(self, scorefunc, once_is_enough=None, mode='all'):
- super(score_entity, self).__init__(mode=mode, once_is_enough=once_is_enough)
+ def __init__(self, scorefunc, mode='all'):
+ super(score_entity, self).__init__(mode=mode)
def intscore(*args, **kwargs):
score = scorefunc(*args, **kwargs)
if not score:
@@ -690,8 +682,8 @@
You can give 'image/' to match any image for instance, or 'image/png' to match
only PNG images.
"""
- def __init__(self, mimetype, once_is_enough=None, mode='all'):
- super(has_mimetype, self).__init__(mode=mode, once_is_enough=once_is_enough)
+ def __init__(self, mimetype, mode='all'):
+ super(has_mimetype, self).__init__(mode=mode)
self.mimetype = mimetype
def score_entity(self, entity):
@@ -995,8 +987,8 @@
See :class:`~cubicweb.predicates.EntityPredicate` documentation for entity
lookup / score rules according to the input context.
"""
- def __init__(self, expression, once_is_enough=None, mode='all', user_condition=False):
- super(rql_condition, self).__init__(mode=mode, once_is_enough=once_is_enough)
+ def __init__(self, expression, mode='all', user_condition=False):
+ super(rql_condition, self).__init__(mode=mode)
self.user_condition = user_condition
if user_condition:
rql = 'Any COUNT(U) WHERE U eid %%(u)s, %s' % expression
@@ -1391,8 +1383,8 @@
is_instance('Version') & (match_transition('ready') |
attribute_edited('publication_date'))
"""
- def __init__(self, attribute, once_is_enough=None, mode='all'):
- super(attribute_edited, self).__init__(mode=mode, once_is_enough=once_is_enough)
+ def __init__(self, attribute, mode='all'):
+ super(attribute_edited, self).__init__(mode=mode)
self._attribute = attribute
def score_entity(self, entity):
--- a/cubicweb/pyramid/core.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/pyramid/core.py Thu Mar 14 12:08:37 2019 +0100
@@ -177,15 +177,6 @@
val = (val.filename, val.file)
if param == '_cwmsgid':
self.set_message_id(val)
- elif param == '__message':
- warn('[3.13] __message in request parameter is deprecated '
- '(may only be given to .build_url). Seeing this message '
- 'usualy means your application hold some <form> where '
- 'you should replace use of __message hidden input by '
- 'form.set_message, so new _cwmsgid mechanism is properly '
- 'used',
- DeprecationWarning)
- self.set_message(val)
else:
self.form[param] = val
--- a/cubicweb/repoapi.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/repoapi.py Thu Mar 14 12:08:37 2019 +0100
@@ -17,27 +17,17 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Official API to access the content of a repository."""
-from warnings import warn
-
-from six import add_metaclass
-
-from logilab.common.deprecation import class_deprecated
-
from cubicweb import AuthenticationError
from cubicweb.server.session import Connection
-def get_repository(uri=None, config=None, vreg=None):
+def get_repository(config, vreg=None):
"""get a repository for the given URI or config/vregistry (in case we're
loading the repository for a client, eg web server, configuration).
The returned repository may be an in-memory repository or a proxy object
using a specific RPC method, depending on the given URI.
"""
- if uri is not None:
- warn('[3.22] get_repository only wants a config')
-
- assert config is not None, 'get_repository(config=config)'
return config.repository(vreg)
@@ -63,8 +53,3 @@
anon_login, anon_password = anoninfo
# use vreg's repository cache
return connect(repo, anon_login, password=anon_password)
-
-
-@add_metaclass(class_deprecated)
-class ClientConnection(Connection):
- __deprecation_warning__ = '[3.20] %(cls)s is deprecated, use Connection instead'
--- a/cubicweb/req.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/req.py Thu Mar 14 12:08:37 2019 +0100
@@ -17,7 +17,6 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Base class for request/session"""
-from warnings import warn
from datetime import time, datetime, timedelta
from six import PY2, PY3, text_type
@@ -26,13 +25,11 @@
urlsplit, urlunsplit)
from logilab.common.decorators import cached
-from logilab.common.deprecation import deprecated
from logilab.common.date import ustrftime, strptime, todate, todatetime
from rql.utils import rqlvar_maker
-from cubicweb import (Unauthorized, NoSelectableObject, NoResultError,
- MultipleResultsError, uilib)
+from cubicweb import Unauthorized, NoSelectableObject, uilib
from cubicweb.rset import ResultSet
ONESECOND = timedelta(0, 1, 0)
@@ -182,29 +179,6 @@
cls = self.vreg['etypes'].etype_class(etype)
return cls.cw_instantiate(self.execute, **kwargs)
- @deprecated('[3.18] use find(etype, **kwargs).entities()')
- def find_entities(self, etype, **kwargs):
- """find entities of the given type and attribute values.
-
- >>> users = find_entities('CWGroup', name=u'users')
- >>> groups = find_entities('CWGroup')
- """
- return self.find(etype, **kwargs).entities()
-
- @deprecated('[3.18] use find(etype, **kwargs).one()')
- def find_one_entity(self, etype, **kwargs):
- """find one entity of the given type and attribute values.
- raise :exc:`FindEntityError` if can not return one and only one entity.
-
- >>> users = find_one_entity('CWGroup', name=u'users')
- >>> groups = find_one_entity('CWGroup')
- Exception()
- """
- try:
- return self.find(etype, **kwargs).one()
- except (NoResultError, MultipleResultsError) as e:
- raise FindEntityError("%s: (%s, %s)" % (str(e), etype, kwargs))
-
def find(self, etype, **kwargs):
"""find entities of the given type and attribute values.
@@ -248,33 +222,6 @@
if first in ('insert', 'set', 'delete'):
raise Unauthorized(self._('only select queries are authorized'))
- def get_cache(self, cachename):
- """cachename should be dotted names as in :
-
- - cubicweb.mycache
- - cubes.blog.mycache
- - etc.
- """
- warn.warning('[3.19] .get_cache will disappear soon. '
- 'Distributed caching mechanisms are being introduced instead.'
- 'Other caching mechanism can be used more reliably '
- 'to the same effect.',
- DeprecationWarning)
- if cachename in CACHE_REGISTRY:
- cache = CACHE_REGISTRY[cachename]
- else:
- cache = CACHE_REGISTRY[cachename] = Cache()
- _now = datetime.now()
- if _now > cache.latest_cache_lookup + ONESECOND:
- ecache = self.execute(
- 'Any C,T WHERE C is CWCache, C name %(name)s, C timestamp T',
- {'name': cachename}).get_entity(0, 0)
- cache.latest_cache_lookup = _now
- if not ecache.valid(cache.cache_creation_date):
- cache.clear()
- cache.cache_creation_date = _now
- return cache
-
# url generation methods ##################################################
def build_url(self, *args, **kwargs):
@@ -296,9 +243,6 @@
# not try to process it and directly call req.build_url()
base_url = kwargs.pop('base_url', None)
if base_url is None:
- if kwargs.pop('__secure__', None) is not None:
- warn('[3.25] __secure__ argument is deprecated',
- DeprecationWarning, stacklevel=2)
base_url = self.base_url()
path = self.build_url_path(method, kwargs)
if not kwargs:
@@ -505,12 +449,7 @@
raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)')
% {'value': value, 'format': format})
- def base_url(self, **kwargs):
+ def base_url(self):
"""Return the root url of the instance."""
- secure = kwargs.pop('secure', None)
- if secure is not None:
- warn('[3.25] secure argument is deprecated', DeprecationWarning, stacklevel=2)
- if kwargs:
- raise TypeError('base_url got unexpected keyword arguments %s' % ', '.join(kwargs))
url = self.vreg.config['base-url']
return url if url is None else url.rstrip('/') + '/'
--- a/cubicweb/rset.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/rset.py Thu Mar 14 12:08:37 2019 +0100
@@ -18,21 +18,15 @@
"""The `ResultSet` class which is returned as result of an rql query"""
-from warnings import warn
-
from six import PY3, text_type
from six.moves import range
-from logilab.common import nullobject
from logilab.common.decorators import cached, clear_cache, copy_cache
from rql import nodes, stmts
from cubicweb import NotAnEntity, NoResultError, MultipleResultsError, UnknownEid
-_MARKER = nullobject()
-
-
class ResultSet(object):
"""A result set wraps a RQL query result. This object implements
partially the list protocol to allow direct use as a list of
@@ -52,10 +46,7 @@
:param rql: the original RQL query string
"""
- def __init__(self, results, rql, args=None, description=None, rqlst=None):
- if rqlst is not None:
- warn('[3.20] rqlst parameter is deprecated',
- DeprecationWarning, stacklevel=2)
+ def __init__(self, results, rql, args=None, description=None):
self.rows = results
self.rowcount = results and len(results) or 0
# original query and arguments
@@ -363,25 +354,17 @@
rset.limited = (limit, offset)
return rset
- def printable_rql(self, encoded=_MARKER):
+ def printable_rql(self):
"""return the result set's origin rql as a string, with arguments
substitued
"""
- if encoded is not _MARKER:
- warn('[3.21] the "encoded" argument is deprecated', DeprecationWarning)
encoding = self.req.encoding
rqlstr = self.syntax_tree().as_string(kwargs=self.args)
if PY3:
return rqlstr
- # sounds like we get encoded or unicode string due to a bug in as_string
- if not encoded:
- if isinstance(rqlstr, text_type):
- return rqlstr
- return text_type(rqlstr, encoding)
- else:
- if isinstance(rqlstr, text_type):
- return rqlstr.encode(encoding)
+ if isinstance(rqlstr, text_type):
return rqlstr
+ return text_type(rqlstr, encoding)
# client helper methods ###################################################
--- a/cubicweb/schema.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/schema.py Thu Mar 14 12:08:37 2019 +0100
@@ -31,7 +31,6 @@
from logilab.common.decorators import cached, clear_cache, monkeypatch, cachedproperty
from logilab.common.logging_ext import set_log_methods
-from logilab.common.deprecation import deprecated
from logilab.common.textutils import splitstrip
from logilab.common.graph import get_cycles
@@ -993,10 +992,6 @@
return False
return True
- @deprecated('use .rdef(subjtype, objtype).role_cardinality(role)')
- def cardinality(self, subjtype, objtype, target):
- return self.rdef(subjtype, objtype).role_cardinality(target)
-
class CubicWebSchema(Schema):
"""set of entities and relations schema defining the possible data sets
--- a/cubicweb/schemas/__init__.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/schemas/__init__.py Thu Mar 14 12:08:37 2019 +0100
@@ -32,20 +32,3 @@
# permissions for relation type that should only set by hooks using unsafe
# execute, readable by anyone
HOOKS_RTYPE_PERMS = RO_REL_PERMS # XXX deprecates
-
-
-from logilab.common.modutils import LazyObject
-from logilab.common.deprecation import deprecated
-class MyLazyObject(LazyObject):
-
- def _getobj(self):
- try:
- return super(MyLazyObject, self)._getobj()
- except ImportError:
- raise ImportError('In cubicweb 3.14, function %s has been moved to '
- 'cube localperms. Install it first.' % self.obj)
-
-for name in ('xperm', 'xexpr', 'xrexpr', 'xorexpr', 'sexpr', 'restricted_sexpr',
- 'restricted_oexpr', 'oexpr', 'relxperm', 'relxexpr', '_perm'):
- msg = '[3.14] import %s from cubes.localperms' % name
- globals()[name] = deprecated(msg, name=name, doc='deprecated')(MyLazyObject('cubes.localperms', name))
--- a/cubicweb/selectors.py Thu Mar 14 14:45:35 2019 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-# copyright 2003-2012 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/>.
-
-from warnings import warn
-
-from six import string_types
-
-from logilab.common.deprecation import deprecated, class_renamed
-
-from cubicweb.predicates import *
-
-
-warn('[3.15] cubicweb.selectors renamed into cubicweb.predicates',
- DeprecationWarning, stacklevel=2)
-
-# XXX pre 3.15 bw compat
-from cubicweb.appobject import (objectify_selector, traced_selection,
- lltrace, yes)
-
-ExpectedValueSelector = class_renamed('ExpectedValueSelector',
- ExpectedValuePredicate)
-EClassSelector = class_renamed('EClassSelector', EClassPredicate)
-EntitySelector = class_renamed('EntitySelector', EntityPredicate)
-
-
-class on_transition(is_in_state):
- """Return 1 if entity is in one of the transitions given as argument list
-
- Especially useful to match passed transition to enable notifications when
- your workflow allows several transition to the same states.
-
- Note that if workflow `change_state` adapter method is used, this predicate
- will not be triggered.
-
- You should use this instead of your own :class:`score_entity` predicate to
- avoid some gotchas:
-
- * possible views gives a fake entity with no state
- * you must use the latest tr info thru the workflow adapter for repository
- side checking of the current state
-
- In debug mode, this predicate can raise:
- :raises: :exc:`ValueError` for unknown transition names
- (etype workflow only not checked in custom workflow)
-
- :rtype: int
- """
- @deprecated('[3.12] on_transition is deprecated, you should rather use '
- 'on_fire_transition(etype, trname)')
- def __init__(self, *expected):
- super(on_transition, self).__init__(*expected)
-
- def _score(self, adapted):
- trinfo = adapted.latest_trinfo()
- if trinfo and trinfo.by_transition:
- return trinfo.by_transition[0].name in self.expected
-
- def _validate(self, adapted):
- wf = adapted.current_workflow
- valid = [n.name for n in wf.reverse_transition_of]
- unknown = sorted(self.expected.difference(valid))
- if unknown:
- raise ValueError("%s: unknown transition(s): %s"
- % (wf.name, ",".join(unknown)))
-
-
-entity_implements = class_renamed('entity_implements', is_instance)
-
-class _but_etype(EntityPredicate):
- """accept if the given entity types are not found in the result set.
-
- See `EntityPredicate` documentation for behaviour when row is not specified.
-
- :param *etypes: entity types (`string_types`) which should be refused
- """
- def __init__(self, *etypes):
- super(_but_etype, self).__init__()
- self.but_etypes = etypes
-
- def score(self, req, rset, row, col):
- if rset.description[row][col] in self.but_etypes:
- return 0
- return 1
-
-but_etype = class_renamed('but_etype', _but_etype, 'use ~is_instance(*etypes) instead')
-
-# XXX deprecated the one_* variants of predicates below w/ multi_xxx(nb=1)?
-# take care at the implementation though (looking for the 'row' argument's
-# value)
-two_lines_rset = class_renamed('two_lines_rset', multi_lines_rset)
-two_cols_rset = class_renamed('two_cols_rset', multi_columns_rset)
-two_etypes_rset = class_renamed('two_etypes_rset', multi_etypes_rset)
--- a/cubicweb/server/hook.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/hook.py Thu Mar 14 12:08:37 2019 +0100
@@ -251,7 +251,6 @@
from itertools import chain
from logilab.common.decorators import classproperty, cached
-from logilab.common.deprecation import deprecated, class_renamed
from logilab.common.logging_ext import set_log_methods
from logilab.common.registry import (NotPredicate, OrPredicate,
objectify_predicate)
@@ -428,10 +427,6 @@
def issued_from_user_query(cls, req, **kwargs):
return 0 if req.hooks_in_progress else 1
-from_dbapi_query = class_renamed('from_dbapi_query',
- issued_from_user_query,
- message='[3.21] ')
-
class rechain(object):
def __init__(self, *iterators):
@@ -738,11 +733,6 @@
self.processed = None # 'precommit', 'commit'
self.failed = False
- @property
- @deprecated('[3.19] Operation.session is deprecated, use Operation.cnx instead')
- def session(self):
- return self.cnx
-
def register(self, cnx):
cnx.add_operation(self, self.insert_index())
--- a/cubicweb/server/migractions.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/migractions.py Thu Mar 14 12:08:37 2019 +0100
@@ -43,7 +43,6 @@
from six import PY2, text_type
-from logilab.common.deprecation import deprecated
from logilab.common.decorators import cached, clear_cache
from yams.buildobjs import EntityType
@@ -1385,20 +1384,6 @@
"""find entities of the given type and attribute values"""
return self.cnx.find(etype, **kwargs)
- @deprecated("[3.19] use find(*args, **kwargs).entities() instead")
- def cmd_find_entities(self, etype, **kwargs):
- """find entities of the given type and attribute values"""
- return self.cnx.find(etype, **kwargs).entities()
-
- @deprecated("[3.19] use find(*args, **kwargs).one() instead")
- def cmd_find_one_entity(self, etype, **kwargs):
- """find one entity of the given type and attribute values.
-
- raise :exc:`cubicweb.req.FindEntityError` if can not return one and only
- one entity.
- """
- return self.cnx.find(etype, **kwargs).one()
-
def cmd_update_etype_fti_weight(self, etype, weight):
if self.repo.system_source.dbdriver == 'postgres':
self.sqlexec('UPDATE appears SET weight=%(weight)s '
@@ -1548,10 +1533,6 @@
if commit:
self.commit()
- @deprecated("[3.15] use rename_relation_type(oldname, newname)")
- def cmd_rename_relation(self, oldname, newname, commit=True):
- self.cmd_rename_relation_type(oldname, newname, commit)
-
class ForRqlIterator:
"""specific rql iterator to make the loop skipable"""
--- a/cubicweb/server/querier.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/querier.py Thu Mar 14 12:08:37 2019 +0100
@@ -45,9 +45,9 @@
ETYPE_PYOBJ_MAP[Binary] = 'Bytes'
-def empty_rset(rql, args, rqlst=None):
+def empty_rset(rql, args):
"""build an empty result set object"""
- return ResultSet([], rql, args, rqlst=rqlst)
+ return ResultSet([], rql, args)
# permission utilities ########################################################
--- a/cubicweb/server/repository.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/repository.py Thu Mar 14 12:08:37 2019 +0100
@@ -36,7 +36,6 @@
from six.moves import range, queue
from logilab.common.decorators import cached, clear_cache
-from logilab.common.deprecation import deprecated
from yams import BadSchemaDefinition
from rql.utils import rqlvar_maker
@@ -323,14 +322,6 @@
for sourceent, source in self._sources())
return mapping
- @property
- @deprecated("[3.25] use source_by_eid(<eid>)")
- def sources_by_eid(self):
- mapping = {self.system_source.eid: self.system_source}
- mapping.update((sourceent.eid, source)
- for sourceent, source in self._sources())
- return mapping
-
def _sources(self):
if self.config.quick_start:
return
@@ -516,31 +507,6 @@
# public (dbapi) interface ################################################
- @deprecated("[3.19] use _cw.call_service('repo_stats')")
- def stats(self): # XXX restrict to managers session?
- """Return a dictionary containing some statistics about the repository
- resources usage.
-
- This is a public method, not requiring a session id.
-
- This method is deprecated in favor of using _cw.call_service('repo_stats')
- """
- with self.internal_cnx() as cnx:
- return cnx.call_service('repo_stats')
-
- @deprecated("[3.19] use _cw.call_service('repo_gc_stats')")
- def gc_stats(self, nmax=20):
- """Return a dictionary containing some statistics about the repository
- memory usage.
-
- This is a public method, not requiring a session id.
-
- nmax is the max number of (most) referenced object returned as
- the 'referenced' result
- """
- with self.internal_cnx() as cnx:
- return cnx.call_service('repo_gc_stats', nmax=nmax)
-
def get_schema(self):
"""Return the instance schema.
@@ -561,16 +527,11 @@
cubes.remove('cubicweb')
return cubes
- def get_option_value(self, option, foreid=None):
+ def get_option_value(self, option):
"""Return the value for `option` in the configuration.
This is a public method, not requiring a session id.
-
- `foreid` argument is deprecated and now useless (as of 3.19).
"""
- if foreid is not None:
- warn('[3.19] foreid argument is deprecated', DeprecationWarning,
- stacklevel=2)
# XXX we may want to check we don't give sensible information
return self.config[option]
@@ -631,17 +592,6 @@
'P pkey K, P value V, NOT P for_user U',
build_descr=False)
- @deprecated("[3.19] Use session.call_service('register_user') instead'")
- def register_user(self, login, password, email=None, **kwargs):
- """check a user with the given login exists, if not create it with the
- given password. This method is designed to be used for anonymous
- registration on public web site.
- """
- with self.internal_cnx() as cnx:
- cnx.call_service('register_user', login=login, password=password,
- email=email, **kwargs)
- cnx.commit()
-
def find_users(self, fetch_attrs, **query_attrs):
"""yield user attributes for cwusers matching the given query_attrs
(the result set cannot survive this method call)
--- a/cubicweb/server/session.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/session.py Thu Mar 14 12:08:37 2019 +0100
@@ -28,7 +28,6 @@
from six import text_type
-from logilab.common.deprecation import deprecated
from logilab.common.registry import objectify_predicate
from cubicweb import QueryError, ProgrammingError, schema, server
@@ -73,15 +72,6 @@
return req.vreg.config.repairing
-@deprecated('[3.17] use <object>.allow/deny_all_hooks_but instead')
-def hooks_control(obj, mode, *categories):
- assert mode in (HOOKS_ALLOW_ALL, HOOKS_DENY_ALL)
- if mode == HOOKS_ALLOW_ALL:
- return obj.allow_all_hooks_but(*categories)
- elif mode == HOOKS_DENY_ALL:
- return obj.deny_all_hooks_but(*categories)
-
-
class _hooks_control(object):
"""context manager to control activated hooks categories.
@@ -123,11 +113,6 @@
self.cnx._hooks_categories = self.old_categories
-@deprecated('[3.17] use <object>.security_enabled instead')
-def security_enabled(obj, *args, **kwargs):
- return obj.security_enabled(*args, **kwargs)
-
-
class _security_enabled(object):
"""context manager to control security w/ session.execute,
@@ -390,11 +375,6 @@
# shared data handling ###################################################
@property
- @deprecated('[3.25] use transaction_data or req.session.data', stacklevel=3)
- def data(self):
- return self.transaction_data
-
- @property
def rql_rewriter(self):
return self._rewriter
@@ -409,24 +389,6 @@
self.local_perm_cache.clear()
self.rewriter = RQLRewriter(self)
- @deprecated('[3.19] cnxset are automatically managed now.'
- ' stop using explicit set and free.')
- def set_cnxset(self):
- pass
-
- @deprecated('[3.19] cnxset are automatically managed now.'
- ' stop using explicit set and free.')
- def free_cnxset(self, ignoremode=False):
- pass
-
- @property
- @contextmanager
- @_open_only
- @deprecated('[3.21] a cnxset is automatically set on __enter__ call now.'
- ' stop using .ensure_cnx_set')
- def ensure_cnx_set(self):
- yield
-
# Entity cache management #################################################
#
# The connection entity cache as held in cnx.transaction_data is removed at the
@@ -702,12 +664,6 @@
"""Return entity type for the entity with id `eid`."""
return self.repo.type_from_eid(eid, self)
- @deprecated('[3.24] use entity_type(eid) instead')
- @_open_only
- def entity_metas(self, eid):
- """Return a dictionary {type}) for the entity with id `eid`."""
- return {'type': self.repo.type_from_eid(eid, self)}
-
# core method #############################################################
@_open_only
--- a/cubicweb/server/sources/datafeed.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/sources/datafeed.py Thu Mar 14 12:08:37 2019 +0100
@@ -33,8 +33,6 @@
from pytz import utc
from lxml import etree
-from logilab.common.deprecation import deprecated
-
from cubicweb import ObjectNotFound, ValidationError, SourceException, _
from cubicweb.server.sources import AbstractSource
from cubicweb.appobject import AppObject
@@ -365,20 +363,6 @@
class DataFeedXMLParser(DataFeedParser):
- @deprecated()
- def process(self, url, raise_on_error=False):
- """IDataFeedParser main entry point"""
- try:
- parsed = self.parse(url)
- except Exception as ex:
- if raise_on_error:
- raise
- self.import_log.record_error(str(ex))
- return True
- for args in parsed:
- self.process_item(*args, raise_on_error=raise_on_error)
- return False
-
def parse(self, url):
stream = self.retrieve_url(url)
return self.parse_etree(etree.parse(stream).getroot())
--- a/cubicweb/server/sqlutils.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/sqlutils.py Thu Mar 14 12:08:37 2019 +0100
@@ -34,7 +34,6 @@
from logilab import database as db, common as lgc
from logilab.common.shellutils import ProgressBar, DummyProgressBar
-from logilab.common.deprecation import deprecated
from logilab.common.logging_ext import set_log_methods
from logilab.common.date import utctime, utcdatetime, strptime
from logilab.database.sqlgen import SQLGenerator
@@ -237,21 +236,6 @@
self.cnx = self._source.get_connection()
self.cu = self.cnx.cursor()
- @deprecated('[3.19] use .cu instead')
- def __getitem__(self, uri):
- assert uri == 'system'
- return self.cu
-
- @deprecated('[3.19] use repo.system_source instead')
- def source(self, uid):
- assert uid == 'system'
- return self._source
-
- @deprecated('[3.19] use .cnx instead')
- def connection(self, uid):
- assert uid == 'system'
- return self.cnx
-
class SqliteConnectionWrapper(ConnectionWrapper):
"""Sqlite specific connection wrapper: close the connection each time it's
--- a/cubicweb/server/test/data-schema2sql/schema/Company.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/test/data-schema2sql/schema/Company.py Thu Mar 14 12:08:37 2019 +0100
@@ -18,6 +18,8 @@
from yams.buildobjs import EntityType, RelationType, RelationDefinition, \
SubjectRelation, String
+from cubicweb import _
+
class Company(EntityType):
name = String()
--- a/cubicweb/server/utils.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/server/utils.py Thu Mar 14 12:08:37 2019 +0100
@@ -32,8 +32,6 @@
from passlib.utils import handlers as uh, to_hash_str
from passlib.context import CryptContext
-from logilab.common.deprecation import deprecated
-
from cubicweb.md5crypt import crypt as md5crypt
@@ -83,17 +81,6 @@
return b''
-@deprecated('[3.22] no more necessary, directly get eschema.eid')
-def eschema_eid(cnx, eschema):
- """get eid of the CWEType entity for the given yams type.
-
- This used to be necessary because when the schema has been loaded from the
- file-system, not from the database, (e.g. during tests), eschema.eid was
- not set.
- """
- return eschema.eid
-
-
DEFAULT_MSG = 'we need a manager connection on the repository \
(the server doesn\'t have to run, even should better not)'
--- a/cubicweb/test/unittest_entity.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/test/unittest_entity.py Thu Mar 14 12:08:37 2019 +0100
@@ -837,16 +837,6 @@
note.cw_set(ecrit_par=person.eid)
self.assertEqual(len(person.reverse_ecrit_par), 2)
- def test_metainformation(self):
- with self.admin_access.client_cnx() as cnx:
- note = cnx.create_entity('Note', type=u'z')
- cnx.commit()
- note.cw_clear_all_caches()
- metainf = note.cw_metainformation()
- self.assertEqual(metainf, {'type': u'Note',
- 'extid': None,
- 'source': {'uri': 'system'}})
-
def test_absolute_url_empty_field(self):
with self.admin_access.web_request() as req:
card = req.create_entity('Card', wikiid=u'', title=u'test')
--- a/cubicweb/test/unittest_predicates.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/test/unittest_predicates.py Thu Mar 14 12:08:37 2019 +0100
@@ -31,12 +31,10 @@
multi_lines_rset, score_entity, is_in_state,
rql_condition, relation_possible, match_form_params,
paginated_rset)
-from cubicweb.selectors import on_transition # XXX on_transition is deprecated
from cubicweb.view import EntityAdapter
from cubicweb.web import action
-
class ImplementsTC(CubicWebTC):
def test_etype_priority(self):
with self.admin_access.web_request() as req:
@@ -147,65 +145,6 @@
self.assertEqual(str(cm.exception),
"wf_test: unknown state(s): unknown,weird")
- def test_on_transition(self):
- with self.statefull_stuff() as (req, wf_entity, rset, adapter):
- for transition in ('validate', 'forsake'):
- selector = on_transition(transition)
- self.assertEqual(selector(None, req, rset=rset), 0)
-
- adapter.fire_transition('validate')
- req.cnx.commit(); wf_entity.cw_clear_all_caches()
- self.assertEqual(adapter.state, 'validated')
-
- clear_cache(rset, 'get_entity')
-
- selector = on_transition("validate")
- self.assertEqual(selector(None, req, rset=rset), 1)
- selector = on_transition("validate", "forsake")
- self.assertEqual(selector(None, req, rset=rset), 1)
- selector = on_transition("forsake")
- self.assertEqual(selector(None, req, rset=rset), 0)
-
- adapter.fire_transition('forsake')
- req.cnx.commit(); wf_entity.cw_clear_all_caches()
- self.assertEqual(adapter.state, 'abandoned')
-
- clear_cache(rset, 'get_entity')
-
- selector = on_transition("validate")
- self.assertEqual(selector(None, req, rset=rset), 0)
- selector = on_transition("validate", "forsake")
- self.assertEqual(selector(None, req, rset=rset), 1)
- selector = on_transition("forsake")
- self.assertEqual(selector(None, req, rset=rset), 1)
-
- def test_on_transition_unvalid_names(self):
- with self.statefull_stuff() as (req, wf_entity, rset, adapter):
- selector = on_transition("unknown")
- with self.assertRaises(ValueError) as cm:
- selector(None, req, rset=rset)
- self.assertEqual(str(cm.exception),
- "wf_test: unknown transition(s): unknown")
- selector = on_transition("weird", "unknown", "validate", "weird")
- with self.assertRaises(ValueError) as cm:
- selector(None, req, rset=rset)
- self.assertEqual(str(cm.exception),
- "wf_test: unknown transition(s): unknown,weird")
-
- def test_on_transition_with_no_effect(self):
- """selector will not be triggered with `change_state()`"""
- with self.statefull_stuff() as (req, wf_entity, rset, adapter):
- adapter.change_state('validated')
- req.cnx.commit(); wf_entity.cw_clear_all_caches()
- self.assertEqual(adapter.state, 'validated')
-
- selector = on_transition("validate")
- self.assertEqual(selector(None, req, rset=rset), 0)
- selector = on_transition("validate", "forsake")
- self.assertEqual(selector(None, req, rset=rset), 0)
- selector = on_transition("forsake")
- self.assertEqual(selector(None, req, rset=rset), 0)
-
class RelationPossibleTC(CubicWebTC):
--- a/cubicweb/test/unittest_req.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/test/unittest_req.py Thu Mar 14 12:08:37 2019 +0100
@@ -18,7 +18,7 @@
from logilab.common.testlib import TestCase, unittest_main
from cubicweb import ObjectNotFound
-from cubicweb.req import RequestSessionBase, FindEntityError
+from cubicweb.req import RequestSessionBase
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb import Unauthorized
@@ -62,64 +62,12 @@
with self.admin_access.repo_cnx() as session:
self.assertEqual(session.base_url(), base_url)
- def test_secure_deprecated(self):
- with self.admin_access.cnx() as cnx:
- with self.assertWarns(DeprecationWarning):
- cnx.base_url(secure=True)
- with self.assertRaises(TypeError):
- cnx.base_url(thing=42)
- with self.assertWarns(DeprecationWarning):
- cnx.build_url('ah', __secure__='whatever')
-
def test_view_catch_ex(self):
with self.admin_access.web_request() as req:
rset = req.execute('CWUser X WHERE X login "hop"')
self.assertEqual(req.view('oneline', rset, 'null'), '')
self.assertRaises(ObjectNotFound, req.view, 'onelinee', rset, 'null')
- def test_find_one_entity(self):
- with self.admin_access.web_request() as req:
- req.create_entity(
- 'CWUser', login=u'cdevienne', upassword=u'cdevienne',
- surname=u'de Vienne', firstname=u'Christophe',
- in_group=req.find('CWGroup', name=u'users').one())
-
- req.create_entity(
- 'CWUser', login=u'adim', upassword='adim', surname=u'di mascio',
- firstname=u'adrien',
- in_group=req.find('CWGroup', name=u'users').one())
-
- u = req.find_one_entity('CWUser', login=u'cdevienne')
- self.assertEqual(u.firstname, u"Christophe")
-
- with self.assertRaises(FindEntityError):
- req.find_one_entity('CWUser', login=u'patanok')
-
- with self.assertRaises(FindEntityError):
- req.find_one_entity('CWUser')
-
- def test_find_entities(self):
- with self.admin_access.web_request() as req:
- req.create_entity(
- 'CWUser', login=u'cdevienne', upassword=u'cdevienne',
- surname=u'de Vienne', firstname=u'Christophe',
- in_group=req.find('CWGroup', name=u'users').one())
-
- req.create_entity(
- 'CWUser', login=u'adim', upassword='adim', surname=u'di mascio',
- firstname=u'adrien',
- in_group=req.find('CWGroup', name=u'users').one())
-
- users = list(req.find_entities('CWUser', login=u'cdevienne'))
- self.assertEqual(1, len(users))
- self.assertEqual(users[0].firstname, u"Christophe")
-
- users = list(req.find_entities('CWUser', login=u'patanok'))
- self.assertEqual(0, len(users))
-
- users = list(req.find_entities('CWUser'))
- self.assertEqual(4, len(users))
-
def test_find(self):
with self.admin_access.web_request() as req:
req.create_entity(
--- a/cubicweb/test/unittest_rtags.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/test/unittest_rtags.py Thu Mar 14 12:08:37 2019 +0100
@@ -137,18 +137,6 @@
{'key0': 'val00', 'key4': 'val4'})
-class DeprecatedInstanceWithoutModule(BaseTestCase):
-
- def test_deprecated_instance_without_module(self):
- class SubRelationTags(RelationTags):
- pass
- with self.assertWarnsRegex(
- DeprecationWarning,
- 'instantiate SubRelationTags with __module__=__name__',
- ):
- SubRelationTags()
-
-
if __name__ == '__main__':
import unittest
unittest.main()
--- a/cubicweb/uilib.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/uilib.py Thu Mar 14 12:08:37 2019 +0100
@@ -32,7 +32,6 @@
from logilab.mtconverter import xml_escape, html_unescape
from logilab.common.date import ustrftime
-from logilab.common.deprecation import deprecated
from cubicweb import _
from cubicweb.utils import js_dumps
@@ -143,10 +142,6 @@
'Interval': print_timedelta,
}
-@deprecated('[3.14] use req.printable_value(attrtype, value, ...)')
-def printable_value(req, attrtype, value, props=None, displaytime=True):
- return req.printable_value(attrtype, value, props, displaytime)
-
def css_em_num_value(vreg, propname, default):
""" we try to read an 'em' css property
if we get another unit we're out of luck and resort to the given default
--- a/cubicweb/utils.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/utils.py Thu Mar 14 12:08:37 2019 +0100
@@ -42,7 +42,6 @@
from six import text_type
from logilab.mtconverter import xml_escape
-from logilab.common.deprecation import deprecated
from logilab.common.date import ustrftime
from cubicweb import Binary
@@ -442,14 +441,6 @@
# keep main_stream's reference on req for easier text/html demoting
req.main_stream = self
- @deprecated('[3.17] there are no namespaces in html, xhtml is not served any longer')
- def add_namespace(self, prefix, uri):
- pass
-
- @deprecated('[3.17] there are no namespaces in html, xhtml is not served any longer')
- def set_namespaces(self, namespaces):
- pass
-
def add_htmlattr(self, attrname, attrvalue):
self._htmlattrs.append( (attrname, attrvalue) )
--- a/cubicweb/view.py Thu Mar 14 14:45:35 2019 +0100
+++ b/cubicweb/view.py Thu Mar 14 12:08:37 2019 +0100
@@ -26,7 +26,6 @@
from six.moves import range
-from logilab.common.deprecation import deprecated
from logilab.common.registry import yes
from logilab.mtconverter import xml_escape
--- a/doc/changes/3.27.rst Thu Mar 14 14:45:35 2019 +0100
+++ b/doc/changes/3.27.rst Thu Mar 14 12:08:37 2019 +0100
@@ -13,3 +13,7 @@
.. _pytest-xdist: https://github.com/pytest-dev/pytest-xdist
+Deprecated code drops
+---------------------
+
+Most code deprecated until version 3.25 has been dropped.