Author: jmorliaguet Date: Fri Jun 23 19:55:59 2006 New Revision: 3498 Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py cpsskins/branches/paris-sprint-2006/storage/interfaces.py cpsskins/branches/paris-sprint-2006/storage/relations.py cpsskins/branches/paris-sprint-2006/storage/storage.py
Log: - API fix: storage.remove() takes object ids as a parameter, not a list of objects. Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/setup/io/utils.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py Fri Jun 23 19:55:59 2006 @@ -53,7 +53,7 @@ # relations relations = mgr.getRelationStorage() - #relations.purge() + relations.purge() document = parseString(archive[u'relations.xml']) root = document.documentElement Modified: cpsskins/branches/paris-sprint-2006/storage/interfaces.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/storage/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/interfaces.py Fri Jun 23 19:55:59 2006 @@ -24,8 +24,8 @@ def add(object, name): """Add an object to the storage. Return the added object.""" - def remove(objects): - """Remove an object from the storage.""" + def remove(ids): + """Remove objects from the storage.""" def duplicate(object, name): """Duplicated an object in the storage. Modified: cpsskins/branches/paris-sprint-2006/storage/relations.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/storage/relations.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/relations.py Fri Jun 23 19:55:59 2006 @@ -280,7 +280,7 @@ """Remove relations for the storage. """ if ids is None: - raise ValueError("Must specify a list of relation ids to remove") + raise ValueError("Must specify the relation id(s) to remove") if isinstance(ids, basestring): ids = [ids] for id in ids: Modified: cpsskins/branches/paris-sprint-2006/storage/storage.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/storage/storage.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/storage.py Fri Jun 23 19:55:59 2006 @@ -61,17 +61,15 @@ notify(ObjectAddedEvent(object)) return self[name] - def remove(self, objects): - """Remove an object from the storage. + def remove(self, ids): + """Remove objects from the storage. """ - if not isinstance(objects, (list, tuple)): - objects = [objects] - for obj in objects: - if IElement.providedBy(obj): - obj = getName(obj) - if obj not in self: - raise KeyError("%s not in the storage." % obj) - del self[obj] + if not isinstance(ids, (list, tuple)): + ids = [ids] + for id in ids: + if id not in self: + raise KeyError("%s not in the storage." % id) + del self[id] def duplicate(self, object, name=u''): """Duplicate an object in the storage. @@ -95,7 +93,7 @@ return self[name] def purge(self): - self.remove(list(self.values())) + self.remove(list(self.keys())) def __setitem__(self, key, object): self._SampleContainer__data[key] = object -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins