diff --git a/api/dao/base.py b/api/dao/base.py index f61254d996cf3a4dc2643a8a987dc1ef1c43c77a..3e0a9386460cd2ca8a0e198f69e113d78bba6878 100644 --- a/api/dao/base.py +++ b/api/dao/base.py @@ -155,7 +155,7 @@ class ContainerStorage(object): if self.use_object_id: try: _id = bson.ObjectId(_id) - except bson.InvalidId as e: + except bson.errors.InvalidId as e: raise APIStorageException(e.message) if recursive and r_payload is not None: containerutil.propagate_changes(self.cont_name, _id, {}, {'$set': util.mongo_dict(r_payload)}) @@ -165,7 +165,7 @@ class ContainerStorage(object): if self.use_object_id: try: _id = bson.ObjectId(_id) - except bson.InvalidId as e: + except bson.errors.InvalidId as e: raise APIStorageException(e.message) return self.dbc.delete_one({'_id':_id}) @@ -173,7 +173,7 @@ class ContainerStorage(object): if self.use_object_id: try: _id = bson.ObjectId(_id) - except bson.InvalidId as e: + except bson.errors.InvalidId as e: raise APIStorageException(e.message) cont = self._from_mongo(self.dbc.find_one(_id, projection)) if fill_defaults: