equal
deleted
inserted
replaced
1 from __future__ import with_statement |
1 from __future__ import with_statement |
|
2 |
2 if confirm('fix existing cwuri?'): |
3 if confirm('fix existing cwuri?'): |
3 from logilab.common.shellutils import ProgressBar |
4 from logilab.common.shellutils import ProgressBar |
4 from cubicweb.server.session import hooks_control |
5 from cubicweb.server.session import hooks_control |
5 rset = rql('Any X, XC WHERE X cwuri XC, X cwuri ~= "%/eid/%"') |
6 rset = rql('Any X, XC WHERE X cwuri XC, X cwuri ~= "%/eid/%"') |
6 pb = ProgressBar(nbops=rset.rowcount, size=70) |
7 pb = ProgressBar(nbops=rset.rowcount, size=70) |
9 e.set_attributes(cwuri=e.cwuri.replace('/eid', '')) |
10 e.set_attributes(cwuri=e.cwuri.replace('/eid', '')) |
10 if i % 100: # commit every 100 entities to limit memory consumption |
11 if i % 100: # commit every 100 entities to limit memory consumption |
11 commit(ask_confirm=False) |
12 commit(ask_confirm=False) |
12 pb.update() |
13 pb.update() |
13 commit(ask_confirm=False) |
14 commit(ask_confirm=False) |
|
15 |
|
16 try: |
|
17 from cubicweb import devtools |
|
18 option_group_changed('anonymous-user', 'main', 'web') |
|
19 option_group_changed('anonymous-password', 'main', 'web') |
|
20 except ImportError: |
|
21 # cubicweb-dev unavailable, nothing needed |
|
22 pass |