Commit 57a88922 authored by Aurelien Campeas's avatar Aurelien Campeas
Browse files

remove cw 3.9 bw compat (bw compat other than the interface -> adapter changes)

- cwconfig, doc/admin/setup: docstring adjustment wrt 3.9 & virtualenv

- testing/rst: windmill (which is gone from the testing infrastructure)

- other docs: "stuff introduced in 3.9" cleanup, as we don't care
  about the version old features were introduced

- server/hooky.py: bw compat for propagation hooks

- server/schemaserial.py: pre CWUniqueTogetherConstraint migration support

- web.__init__.py: dumps bw import

- autoform.py: .action ppty is gone, also deprecate set_action and get_action

- baseviews: CSVView.subvid gone long ago, secondary view removal

- primary.py: _render_attribute & _render_relation signature change

- reledit.py: rvid/default_value bw compat, should_edit_* dropped

- webconfig.py: resourcefile is gone

- formfields.py: old vocabulary handling

- request.py: build_ajax_replace_url, external_resource


Related to #2782004.
parent 697a8181ba30
......@@ -53,8 +53,7 @@ Within virtual environment
If you are not administrator of you machine or if you need to play with some
specific version of |cubicweb| you can use `virtualenv`_ a tool to create
isolated Python environments. Since version 3.9 |cubicweb| is **`virtualenv`
friendly** and won't write any file outside the virtualenv directory.
isolated Python environments.
- instances are stored in :file:`<VIRTUAL_ENV>/etc/cubicweb.d`
- temporary files (such as pid file) in :file:`<VIRTUAL_ENV>/var/run/cubicweb`
......
......@@ -29,5 +29,4 @@ Deprecated Code Drops
* all 3.8 backward compat is gone
* all 3.9 backward compat for the interface -> adapter transition is
gone
* all 3.9 backward compat (except javascript side) is gone
......@@ -121,10 +121,10 @@ environment or if you are having problems with `easy_install`, read on to
`Virtualenv` install
--------------------
Since version 3.9, |cubicweb| can be safely installed, used and contained inside
a `virtualenv`_. You can use either :ref:`pip <PipInstallation>` or
:ref:`easy_install <EasyInstallInstallation>` to install |cubicweb| inside an
activated virtual environment.
|cubicweb| can be safely installed, used and contained inside a
`virtualenv`_. You can use either :ref:`pip <PipInstallation>` or
:ref:`easy_install <EasyInstallInstallation>` to install |cubicweb|
inside an activated virtual environment.
.. _PipInstallation:
......
......@@ -18,12 +18,7 @@ actions, hooks and operations, security. The
convenience methods to help test all of this.
In the realm of views, automatic tests check that views are valid
XHTML. See :ref:`automatic_views_tests` for details. Since 3.9, bases
for web functional testing using `windmill
<http://www.getwindmill.com/>`_ are set. See test cases in
cubicweb/web/test/windmill and python wrapper in
cubicweb/web/test_windmill/ if you want to use this in your own cube.
XHTML. See :ref:`automatic_views_tests` for details.
Most unit tests need a live database to work against. This is achieved
by CubicWeb using automatically sqlite (bundled with Python, see
......
......@@ -673,16 +673,6 @@ class PropagateRelationDelHook(PropagateRelationAddHook):
{'x': self.eidfrom, 'p': self.eidto})
PropagateSubjectRelationHook = class_renamed(
'PropagateSubjectRelationHook', PropagateRelationHook,
'[3.9] PropagateSubjectRelationHook has been renamed to PropagateRelationHook')
PropagateSubjectRelationAddHook = class_renamed(
'PropagateSubjectRelationAddHook', PropagateRelationAddHook,
'[3.9] PropagateSubjectRelationAddHook has been renamed to PropagateRelationAddHook')
PropagateSubjectRelationDelHook = class_renamed(
'PropagateSubjectRelationDelHook', PropagateRelationDelHook,
'[3.9] PropagateSubjectRelationDelHook has been renamed to PropagateRelationDelHook')
# abstract classes for operation ###############################################
......
......@@ -232,28 +232,24 @@ def deserialize_schema(schema, session):
if rdefs is not None:
set_perms(rdefs, permsidx)
unique_togethers = {}
try:
rset = session.execute(
'Any X,E,R WHERE '
'X is CWUniqueTogetherConstraint, '
'X constraint_of E, X relations R', build_descr=False)
except Exception:
session.rollback() # first migration introducing CWUniqueTogetherConstraint cw 3.9.6
else:
for values in rset:
uniquecstreid, eeid, releid = values
eschema = schema.schema_by_eid(eeid)
relations = unique_togethers.setdefault(uniquecstreid, (eschema, []))
rel = ertidx[releid]
if isinstance(rel, schemamod.RelationDefinitionSchema):
# not yet migrated 3.9 database ('relations' target type changed
# to CWRType in 3.10)
rtype = rel.rtype.type
else:
rtype = str(rel)
relations[1].append(rtype)
for eschema, unique_together in unique_togethers.itervalues():
eschema._unique_together.append(tuple(sorted(unique_together)))
rset = session.execute(
'Any X,E,R WHERE '
'X is CWUniqueTogetherConstraint, '
'X constraint_of E, X relations R', build_descr=False)
for values in rset:
uniquecstreid, eeid, releid = values
eschema = schema.schema_by_eid(eeid)
relations = unique_togethers.setdefault(uniquecstreid, (eschema, []))
rel = ertidx[releid]
if isinstance(rel, schemamod.RelationDefinitionSchema):
# not yet migrated 3.9 database ('relations' target type changed
# to CWRType in 3.10)
rtype = rel.rtype.type
else:
rtype = str(rel)
relations[1].append(rtype)
for eschema, unique_together in unique_togethers.itervalues():
eschema._unique_together.append(tuple(sorted(unique_together)))
schema.infer_specialization_rules()
session.commit()
schema.reading_from_database = False
......
......@@ -31,8 +31,6 @@ from cubicweb.utils import json_dumps
from cubicweb.uilib import eid_param
assert json_dumps is not None, 'no json module installed'
dumps = deprecated('[3.9] use cubicweb.utils.json_dumps instead of dumps')(
json_dumps)
INTERNAL_FIELD_VALUE = '__cubicweb_internal_field__'
......
......@@ -404,17 +404,6 @@ class Field(object):
for label, value in vocab]
if self.sort:
vocab = vocab_sort(vocab)
# XXX pre 3.9 bw compat
for i, option in enumerate(vocab):
# option may be a 2 or 3-uple (see Select widget _render method for
# explanation)
value = option[1]
if value is not None and not isinstance(value, basestring):
warn('[3.9] %s: vocabulary value should be an unicode string'
% self, DeprecationWarning)
option = list(option)
option[1] = unicode(value)
vocab[i] = option
return vocab
# support field as argument to avoid warning when used as format field value
......
......@@ -684,12 +684,6 @@ class CubicWebRequestBase(DBAPIRequest):
cssfile = self.data_url(cssfile)
add_css(cssfile, media, *extraargs)
@deprecated('[3.9] use ajax_replace_url() instead, naming rql and vid arguments')
def build_ajax_replace_url(self, nodeid, rql, vid, replacemode='replace',
**extraparams):
return self.ajax_replace_url(nodeid, replacemode, rql=rql, vid=vid,
**extraparams)
def ajax_replace_url(self, nodeid, replacemode='replace', **extraparams):
"""builds an ajax url that will replace nodeid's content
......@@ -992,20 +986,6 @@ class CubicWebRequestBase(DBAPIRequest):
def html_content_type(self):
return 'text/html'
@deprecated('[3.9] use req.uiprops[rid]')
def external_resource(self, rid, default=_MARKER):
"""return a path to an external resource, using its identifier
raise `KeyError` if the resource is not defined
"""
try:
return self.uiprops[rid]
except KeyError:
if default is _MARKER:
raise
return default
## HTTP-accept parsers / utilies ##############################################
def _mimetype_sort_key(accept_info):
......
......@@ -726,16 +726,17 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
# action on the form tag
_default_form_action_path = 'validateform'
# pre 3.8.3 compat
@deprecated('[3.18] you should override form_action()')
def set_action(self, action):
self._action = action
@deprecated('[3.18] use form_action()')
def get_action(self):
try:
return self._action
except AttributeError:
return self._cw.build_url(self._default_form_action_path)
action = property(deprecated('[3.9] use form.form_action()')(get_action),
set_action)
@iclassmethod
def field_by_name(cls_or_self, name, role=None, eschema=None):
......
......@@ -424,11 +424,7 @@ class CSVView(SimpleListView):
redirect_vid = 'incontext'
def call(self, subvid=None, **kwargs):
if subvid is None and 'vid' in kwargs:
warn("[3.9] should give a 'subvid' argument instead of 'vid'",
DeprecationWarning, stacklevel=2)
else:
kwargs['vid'] = subvid
kwargs['vid'] = subvid
rset = self.cw_rset
for i in xrange(len(rset)):
self.cell_call(i, 0, **kwargs)
......@@ -643,14 +639,3 @@ XmlRsetView = class_moved(xmlrss.XMLRsetView)
RssView = class_moved(xmlrss.RSSView)
RssItemView = class_moved(xmlrss.RSSItemView)
TableView = class_moved(tableview.TableView)
class SecondaryView(EntityView):
__metaclass__ = class_deprecated
__deprecation_warning__ = '[3.9] the secondary view is deprecated, use one of oneline/incontext/outofcontext'
__regid__ = 'secondary'
def cell_call(self, row, col, **kwargs):
entity = self.cw_rset.get_entity(row, col)
self.w(u'&#160;')
self.wview('oneline', self.cw_rset, row=row, col=col)
......@@ -213,16 +213,8 @@ class PrimaryView(EntityView):
if display_attributes:
self.w(u'<table>')
for rschema, role, dispctrl, value in display_attributes:
# pylint: disable=E1101
if not hasattr(self, '_render_attribute'):
label = self._rel_label(entity, rschema, role, dispctrl)
self.render_attribute(label, value, table=True)
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)
label = self._rel_label(entity, rschema, role, dispctrl)
self.render_attribute(label, value, table=True)
self.w(u'</table>')
def render_attribute(self, label, value, table=False):
......@@ -249,13 +241,6 @@ class PrimaryView(EntityView):
rset = self._relation_rset(entity, rschema, role, dispctrl, limit=limit)
if not rset:
continue
if hasattr(self, '_render_relation'):
# pylint: disable=E1101
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
try:
rview = self._cw.vreg['views'].select(
vid, self._cw, rset=rset, dispctrl=dispctrl)
......
......@@ -91,9 +91,6 @@ class AutoClickAndEditFormView(EntityView):
rschema = self._cw.vreg.schema[rtype]
rctrl = self._cw.vreg['uicfg'].select('reledit', self._cw, entity=entity)
self._rules = rctrl.etype_get(self.entity.e_schema.type, rschema.type, role, '*')
if rvid is not None or default_value is not None:
warn('[3.9] specifying rvid/default_value on select is deprecated, '
'reledit_ctrl rtag to control this' % self, DeprecationWarning)
reload = self._compute_reload(rschema, role, reload)
divid = self._build_divid(rtype, role, self.entity.eid)
if rschema.final:
......@@ -322,19 +319,11 @@ class AutoClickAndEditFormView(EntityView):
rdef = entity.e_schema.rdef(rschema)
return rdef.has_perm(self._cw, 'update', eid=entity.eid)
should_edit_attributes = deprecated('[3.9] should_edit_attributes is deprecated,'
' use _should_edit_attribute instead',
_should_edit_attribute)
def _should_edit_relation(self, rschema, role):
eeid = self.entity.eid
perm_args = {'fromeid': eeid} if role == 'subject' else {'toeid': eeid}
return rschema.has_perm(self._cw, 'add', **perm_args)
should_edit_relations = deprecated('[3.9] should_edit_relations is deprecated,'
' use _should_edit_relation instead',
_should_edit_relation)
def _open_form_wrapper(self, divid, value, form, renderer,
_edit_related, _add_related, _delete_related):
w = self.w
......
......@@ -401,7 +401,7 @@ have the python imaging library installed to use captcha)',
self._load_ui_properties_file(uiprops, path)
self._load_ui_properties_file(uiprops, self.apphome)
datadir_url = uiprops.context['datadir_url']
# XXX pre 3.9 css compat
# pre 3.9 css compat, however the old css still rules
if self['use-old-css']:
if (datadir_url+'/cubicweb.css') in uiprops['STYLESHEETS']:
idx = uiprops['STYLESHEETS'].index(datadir_url+'/cubicweb.css')
......@@ -413,21 +413,6 @@ have the python imaging library installed to use captcha)',
uiprops['JAVASCRIPTS'].insert(0, cubicweb_js_url)
def _load_ui_properties_file(self, uiprops, path):
resourcesfile = join(path, 'data', 'external_resources')
if exists(resourcesfile):
warn('[3.9] %s file is deprecated, use an uiprops.py file'
% resourcesfile, DeprecationWarning)
datadir_url = uiprops.context['datadir_url']
for rid, val in read_config(resourcesfile).iteritems():
if rid in ('STYLESHEETS', 'STYLESHEETS_PRINT',
'IE_STYLESHEETS', 'JAVASCRIPTS'):
val = [w.strip().replace('DATADIR', datadir_url)
for w in val.split(',') if w.strip()]
if rid == 'IE_STYLESHEETS':
rid = 'STYLESHEETS_IE'
else:
val = val.strip().replace('DATADIR', datadir_url)
uiprops[rid] = val
uipropsfile = join(path, 'uiprops.py')
if exists(uipropsfile):
self.debug('loading %s', uipropsfile)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment