misc/migration/3.10.0_Any.py
changeset 10684 7e9c9a32f24f
parent 9460 a2a0bc984863
child 10907 9ae707db5265
equal deleted inserted replaced
10683:e83de6c409fd 10684:7e9c9a32f24f
       
     1 from six import text_type
       
     2 
     1 from cubicweb.server.session import hooks_control
     3 from cubicweb.server.session import hooks_control
     2 
     4 
     3 for uri, cfg in config.read_sources_file().items():
     5 for uri, cfg in config.read_sources_file().items():
     4     if uri in ('system', 'admin'):
     6     if uri in ('system', 'admin'):
     5         continue
     7         continue
    22     if uri in ('system', 'admin'):
    24     if uri in ('system', 'admin'):
    23         continue
    25         continue
    24     repo.sources_by_uri.pop(uri)
    26     repo.sources_by_uri.pop(uri)
    25     config = u'\n'.join('%s=%s' % (key, value) for key, value in cfg.items()
    27     config = u'\n'.join('%s=%s' % (key, value) for key, value in cfg.items()
    26                         if key != 'adapter' and value is not None)
    28                         if key != 'adapter' and value is not None)
    27     create_entity('CWSource', name=unicode(uri), type=unicode(cfg['adapter']),
    29     create_entity('CWSource', name=text_type(uri), type=text_type(cfg['adapter']),
    28                   config=config)
    30                   config=config)
    29 commit()
    31 commit()
    30 
    32 
    31 # rename cwprops for boxes/contentnavigation
    33 # rename cwprops for boxes/contentnavigation
    32 for x in rql('Any X,XK WHERE X pkey XK, '
    34 for x in rql('Any X,XK WHERE X pkey XK, '