equal
deleted
inserted
replaced
1 from __future__ import print_function |
|
2 |
|
3 config['rql-cache-size'] = config['rql-cache-size'] * 10 |
|
4 |
|
5 add_entity_type('CWDataImport') |
|
6 |
|
7 from cubicweb.schema import CONSTRAINTS, guess_rrqlexpr_mainvars |
|
8 for rqlcstr in rql('Any X,XT,XV WHERE X is CWConstraint, X cstrtype XT, X value XV,' |
|
9 'X cstrtype XT, XT name IN ("RQLUniqueConstraint","RQLConstraint","RQLVocabularyConstraint"),' |
|
10 'NOT X value ~= ";%"').entities(): |
|
11 expression = rqlcstr.value |
|
12 mainvars = guess_rrqlexpr_mainvars(expression) |
|
13 yamscstr = CONSTRAINTS[rqlcstr.type](expression, mainvars) |
|
14 rqlcstr.cw_set(value=yamscstr.serialize()) |
|
15 print('updated', rqlcstr.type, rqlcstr.value.strip()) |
|