From e69796eaaa7a9c64aee3fc3acc4017e176c3eb70 Mon Sep 17 00:00:00 2001 From: ale-rt Date: Mon, 13 May 2019 16:00:51 +0200 Subject: [PATCH 1/2] Workaround to fix the path of moved objects --- five/intid/README.rst | 3 ++- five/intid/intid.py | 3 +++ five/intid/keyreference.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/five/intid/README.rst b/five/intid/README.rst index f5914b7..c7ad47c 100644 --- a/five/intid/README.rst +++ b/five/intid/README.rst @@ -150,6 +150,8 @@ Renaming an object should not break the rewrapping of the object: >>> moved = intid.getObject(ob_id) >>> moved + >>> [x.path for x in intid.ids] + ['/test_folder_1_/mycont_new'] Nor should moving it: @@ -361,4 +363,3 @@ Creating items whith a circular containment ... TypeError: ('Could not adapt', , ) - diff --git a/five/intid/intid.py b/five/intid/intid.py index 768a364..1ada637 100644 --- a/five/intid/intid.py +++ b/five/intid/intid.py @@ -154,6 +154,9 @@ def moveIntIdSubscriber(ob, event): for utility in utilities: try: uid = utility.getId(ob) + # XXX this is a temporary workaround + utility.refs.pop(uid, None) + utility.ids.pop(key, None) utility.refs[uid] = key utility.ids[key] = uid except KeyError: diff --git a/five/intid/keyreference.py b/five/intid/keyreference.py index 57199a1..46e9f02 100644 --- a/five/intid/keyreference.py +++ b/five/intid/keyreference.py @@ -132,11 +132,13 @@ def __call__(self): return self.wrapped_object def __hash__(self): + # XXX Maybe we should consider to use also other fields for the hash return hash((self.dbname, self.object._p_oid, )) def __cmp__(self, other): + # XXX This makes no sense on Python 3 if self.key_type_id == other.key_type_id: return cmp((self.dbname, self.oid), (other.dbname, other.oid)) return cmp(self.key_type_id, other.key_type_id) From c66e77c823413f343054e42d14bdc56dd416b31d Mon Sep 17 00:00:00 2001 From: ale-rt Date: Mon, 13 May 2019 16:13:53 +0200 Subject: [PATCH 2/2] Add a towncrier entry --- news/8.fixed | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/8.fixed diff --git a/news/8.fixed b/news/8.fixed new file mode 100644 index 0000000..9fbed21 --- /dev/null +++ b/news/8.fixed @@ -0,0 +1 @@ +Properly update the persistent objects stored in the initid utility btrees [ale-rt]