misc/migration/2.99.0_Any.py
author Florent <florent@secondweb.fr>
Tue, 19 May 2009 17:05:54 +0200
branchstable
changeset 1873 e96f50e52099
parent 1398 5fe84a5f7035
child 1977 606923dff11b
permissions -rw-r--r--
allow easy arbitrary separator between checkbox/ radio widgets

from cubicweb import CW_MIGRATION_MAP

for pk, in rql('Any K WHERE X is CWProperty, X pkey IN (%s), X pkey K'
               % ','.join("'system.version.%s'" % cube for cube in CW_MIGRATION_MAP),
               ask_confirm=False):
    cube = pk.split('.')[-1]
    newk = pk.replace(cube, CW_MIGRATION_MAP[cube])
    rql('SET X pkey %(newk)s WHERE X pkey %(oldk)s',
        {'oldk': pk, 'newk': newk}, ask_confirm=False)
    print 'renamed', pk, 'to', newk

add_entity_type('CWCache')