cubicweb/misc/migration/3.14.0_Any.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Tue, 22 Dec 2015 09:23:00 +0100
changeset 11144 fd8bf29ed00e
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[tox] Generate test environments for Python 2.7 and 3.4 Test commands for each environment are written down explicitly since I could not find a way to extract the "package" name (e.g. "hooks") from the environment name (e.g. "py34-hooks"). For Python 3.4 interpreter, only environments (subpackages) that do not depend on cubes for their tests are listed since those test dependency cubes are not yet installable with Python 3.x. etwist is also not included since the Python 3 port is not complete at the moment. From local testing, py34 tests pass for the following subpackages: - dataimport - entities - ext - hooks - wsgi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 8483
diff changeset
     1
from __future__ import print_function
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 8483
diff changeset
     2
7954
a3d3220669d6 [cache] replace lgc.cache with something more appropriate (closes #1921713)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     3
config['rql-cache-size'] = config['rql-cache-size'] * 10
a3d3220669d6 [cache] replace lgc.cache with something more appropriate (closes #1921713)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     4
7995
9a9f35ef418c Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7954
diff changeset
     5
add_entity_type('CWDataImport')
8027
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     6
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     7
from cubicweb.schema import CONSTRAINTS, guess_rrqlexpr_mainvars
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     8
for rqlcstr in rql('Any X,XT,XV WHERE X is CWConstraint, X cstrtype XT, X value XV,'
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     9
                   'X cstrtype XT, XT name IN ("RQLUniqueConstraint","RQLConstraint","RQLVocabularyConstraint"),'
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    10
                   'NOT X value ~= ";%"').entities():
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    11
    expression = rqlcstr.value
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    12
    mainvars = guess_rrqlexpr_mainvars(expression)
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    13
    yamscstr = CONSTRAINTS[rqlcstr.type](expression, mainvars)
8483
4ba11607d84a [entity api] unify set_attributes / set_relations into a cw_set method. Closes #2423719
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 8079
diff changeset
    14
    rqlcstr.cw_set(value=yamscstr.serialize())
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 8483
diff changeset
    15
    print('updated', rqlcstr.type, rqlcstr.value.strip())