diff options
Diffstat (limited to '')
-rw-r--r-- | umosapi/app_db/uobject.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/umosapi/app_db/uobject.py b/umosapi/app_db/uobject.py index 3d29bf6..0ba328c 100644 --- a/umosapi/app_db/uobject.py +++ b/umosapi/app_db/uobject.py @@ -18,7 +18,7 @@ class UObject(object): error = {} if not name: - error = {'msg': 'Object name is required.', 'code': 400} + error = {"msg": "Object name is required.", "code": 400} elif type(datas) != dict: error = { "msg": "Object datas type is not dict (JSON).", @@ -26,12 +26,12 @@ class UObject(object): } elif len(list(mongo.db.objects.find({"name": name}))) > 0: error = { - 'msg': 'Object {} is already registered.'.format(name), - 'code': 409 + "msg": "Object {} is already registered.".format(name), + "code": 409 } if not error: mongo.db.objects.insert({"name": name, "datas": datas}) - return {'msg': 'Object {} added.'.format(name), 'code': 201} + return {"msg": "Object {} added.".format(name), "code": 201} return error def remove(self, name): @@ -40,14 +40,14 @@ class UObject(object): error = {} if not name: - error = {'msg': 'Object name is required', 'code': 400} + error = {"msg": "Object name is required", "code": 400} elif len(list(mongo.db.objects.find({"name": name}))) == 0: error = { 'msg': "User {} not exist. So it's good".format(name), - 'code': 404 + "code": 404 } if not error: - mongo.db.objects.remove({'name': name}) - return {'msg': 'Object {} deleted'.format(name), 'code': 200} + mongo.db.objects.remove({"name": name}) + return {"msg": "Object {} deleted".format(name), "code": 200} return error |