--- a/entity.py Wed Feb 09 16:16:20 2011 +0100
+++ b/entity.py Wed Feb 09 18:06:13 2011 +0100
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
--- a/hooks/metadata.py Wed Feb 09 16:16:20 2011 +0100
+++ b/hooks/metadata.py Wed Feb 09 18:06:13 2011 +0100
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -44,7 +44,7 @@
edited.setdefault('creation_date', timestamp)
edited.setdefault('modification_date', timestamp)
if not self._cw.get_shared_data('do-not-insert-cwuri'):
- cwuri = u'%seid/%s' % (self._cw.base_url(), self.entity.eid)
+ cwuri = u'%s%s' % (self._cw.base_url(), self.entity.eid)
edited.setdefault('cwuri', cwuri)
--- a/hooks/syncschema.py Wed Feb 09 16:16:20 2011 +0100
+++ b/hooks/syncschema.py Wed Feb 09 18:06:13 2011 +0100
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/migration/3.10.9_Any.py Wed Feb 09 18:06:13 2011 +0100
@@ -0,0 +1,12 @@
+if confirm('fix existing cwuri?'):
+ from logilab.common.shellutils import ProgressBar
+ from cubicweb.server.session import hooks_control
+ rset = rql('Any X, XC WHERE X cwuri XC, X cwuri ~= "%/eid/%"')
+ pb = ProgressBar(nbops=rset.rowcount, size=70)
+ with hooks_control(session, session.HOOKS_DENY_ALL, 'integrity'):
+ for i, e in enumerate(rset.entities()):
+ e.set_attributes(cwuri=e.cwuri.replace('/eid', ''))
+ if i % 100: # commit every 100 entities to limit memory consumption
+ commit(ask_confirm=False)
+ pb.update()
+ commit(ask_confirm=False)
--- a/server/hook.py Wed Feb 09 16:16:20 2011 +0100
+++ b/server/hook.py Wed Feb 09 18:06:13 2011 +0100
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.