41 create_user(session, unicode(anonlogin), anonpwd, 'guests') |
41 create_user(session, unicode(anonlogin), anonpwd, 'guests') |
42 |
42 |
43 # need this since we already have at least one user in the database (the default admin) |
43 # need this since we already have at least one user in the database (the default admin) |
44 for user in rql('Any X WHERE X is CWUser').entities(): |
44 for user in rql('Any X WHERE X is CWUser').entities(): |
45 rql('SET X in_state S WHERE X eid %(x)s, S eid %(s)s', |
45 rql('SET X in_state S WHERE X eid %(x)s, S eid %(s)s', |
46 {'x': user.eid, 's': activated.eid}, 'x') |
46 {'x': user.eid, 's': activated.eid}) |
47 |
47 |
48 # on interactive mode, ask for level 0 persistent options |
48 # on interactive mode, ask for level 0 persistent options |
49 if interactive_mode: |
49 if interactive_mode: |
50 cfg = config.persistent_options_configuration() |
50 cfg = config.persistent_options_configuration() |
51 cfg.input_config(inputlevel=0) |
51 cfg.input_config(inputlevel=0) |
53 for optname, optdict, value in options: |
53 for optname, optdict, value in options: |
54 key = '%s.%s' % (section, optname) |
54 key = '%s.%s' % (section, optname) |
55 default = cfg.option_default(optname, optdict) |
55 default = cfg.option_default(optname, optdict) |
56 # only record values differing from default |
56 # only record values differing from default |
57 if value != default: |
57 if value != default: |
58 rql('INSERT CWProperty X: X pkey %(k)s, X value %(v)s', {'k': key, 'v': value}) |
58 rql('INSERT CWProperty X: X pkey %(k)s, X value %(v)s', |
|
59 {'k': key, 'v': value}) |
59 |
60 |
60 # add PERM_USE_TEMPLATE_FORMAT permission |
61 # add PERM_USE_TEMPLATE_FORMAT permission |
61 from cubicweb.schema import PERM_USE_TEMPLATE_FORMAT |
62 from cubicweb.schema import PERM_USE_TEMPLATE_FORMAT |
62 usetmplperm = create_entity('CWPermission', name=PERM_USE_TEMPLATE_FORMAT, |
63 usetmplperm = create_entity('CWPermission', name=PERM_USE_TEMPLATE_FORMAT, |
63 label=_('use template languages')) |
64 label=_('use template languages')) |
64 rql('SET X require_group G WHERE G name "managers", X eid %(x)s', |
65 rql('SET X require_group G WHERE G name "managers", X eid %(x)s', |
65 {'x': usetmplperm.eid}, 'x') |
66 {'x': usetmplperm.eid}) |