misc/migration/3.14.0_Any.py
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 25 Jun 2013 11:06:57 +0200
changeset 9052 4cba5f2cd57b
parent 8483 4ba11607d84a
child 10589 7c23b7de2b8d
permissions -rw-r--r--
[repoapi] introduce a basic ClientConnection class This is the new official way to access the repo from client side. It still access Session object directly as the server side connection is not up yet (and it's not up because it would have no user). Multiple follow up commit will install compatibility with the DBAPI. This will ease the migration from dbapi to repoapi. ClientConnection has no user yet but later commit will use it in the whole Web stack. related to #2503918
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7954
a3d3220669d6 [cache] replace lgc.cache with something more appropriate (closes #1921713)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     1
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
     2
7995
9a9f35ef418c Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7954
diff changeset
     3
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
     4
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
     5
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
     6
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
     7
                   '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
     8
                   '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
     9
    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
    10
    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
    11
    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
    12
    rqlcstr.cw_set(value=yamscstr.serialize())
8079
0f1126b9038e [3.14 migration] strip constraint value to avoid extra new lines
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 8027
diff changeset
    13
    print 'updated', rqlcstr.type, rqlcstr.value.strip()