Commit d2450e66 authored by Andreas Jung's avatar Andreas Jung

added more checks for _length attribute

parent 819920c9
...@@ -339,6 +339,8 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -339,6 +339,8 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if index is None: # we are inserting new data if index is None: # we are inserting new data
index = self.updateMetadata(object, uid) index = self.updateMetadata(object, uid)
if not hasattr(self, '_length'):
self.migrate__len__()
self._length.change(1) self._length.change(1)
self.uids[uid] = index self.uids[uid] = index
self.paths[index] = uid self.paths[index] = uid
...@@ -389,6 +391,8 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -389,6 +391,8 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
del data[rid] del data[rid]
del paths[rid] del paths[rid]
del uids[uid] del uids[uid]
if not hasattr(self, '_length'):
self.migrate__len__()
self._length.change(-1) self._length.change(-1)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment