cubicweb/misc/migration/3.14.0_Any.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Thu, 21 Mar 2019 14:33:54 +0100
changeset 12530 9d88e1177c35
parent 11057 0b59724cb3f2
permissions -rw-r--r--
Remove Twisted web server Twisted web server is not used anymore and has been superseded by pyramid many years ago. Furthermore, our usage is not compatible with Python 3. So we drop the "etwist" sub-package. As a consequence, "all-in-one" configuration type gets dropped as it was Twisted-specific. We resurrect it in cubicweb/pyramid/config.py by only keeping options used by the "pyramid". Similarly, we introduce a AllInOneCreateHandler in cubicweb/pyramid/pyramidctl.py that is basically the one that lived in cubicweb/etwist/twctl.py and is used to create the "all-in-one" instance. Added a TODO here about "pyramid.ini" that could be generated at the end of bootstrap() method. In cubicweb/devtools/httptest.py, CubicWebServerTC is now equivalent to CubicWebWsgiTC and the latter is dropped.
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())