Skip to content

Commit

Permalink
added more checks for _length attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
zopyx committed Oct 15, 2004
1 parent 8b78529 commit 4c8fedc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Catalog.py
Expand Up @@ -339,6 +339,8 @@ def catalogObject(self, object, uid, threshold=None, idxs=None,
if index is None: # we are inserting new data
index = self.updateMetadata(object, uid)

if not hasattr(self, '_length'):
self.migrate__len__()
self._length.change(1)
self.uids[uid] = index
self.paths[index] = uid
Expand Down Expand Up @@ -389,6 +391,8 @@ def uncatalogObject(self, uid):
del data[rid]
del paths[rid]
del uids[uid]
if not hasattr(self, '_length'):
self.migrate__len__()
self._length.change(-1)

else:
Expand Down

0 comments on commit 4c8fedc

Please sign in to comment.