aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-07-08 17:05:19 +0200
committerneodarz <neodarz@neodarz.net>2019-07-08 17:05:19 +0200
commit48fb32c74aa9eb3308235785da2400f82b5fe5f1 (patch)
tree9a29ad1ae772f4840141af7448d248bf886d14a4
parent6dffc5977642b8529e39348bcf5f78b33199f968 (diff)
downloadumosapi-48fb32c74aa9eb3308235785da2400f82b5fe5f1.tar.xz
umosapi-48fb32c74aa9eb3308235785da2400f82b5fe5f1.zip
Fix some typosv0.1
-rw-r--r--umosapi/app_db/uobject.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/umosapi/app_db/uobject.py b/umosapi/app_db/uobject.py
index 0ba328c..7f26935 100644
--- a/umosapi/app_db/uobject.py
+++ b/umosapi/app_db/uobject.py
@@ -10,7 +10,7 @@ class UObject(object):
def all(self):
db = MongoDB(self.app)
mongo = db.connection()
- return list(mongo.db.objects.find({}))
+ return list(mongo.db.uobjects.find({}))
def register(self, name, datas):
db = MongoDB(self.app)
@@ -18,20 +18,20 @@ class UObject(object):
error = {}
if not name:
- error = {"msg": "Object name is required.", "code": 400}
+ error = {"msg": "UObject name is required.", "code": 400}
elif type(datas) != dict:
error = {
- "msg": "Object datas type is not dict (JSON).",
+ "msg": "UObject datas type is not dict (JSON).",
"code": 400
}
- elif len(list(mongo.db.objects.find({"name": name}))) > 0:
+ elif len(list(mongo.db.uobjects.find({"name": name}))) > 0:
error = {
- "msg": "Object {} is already registered.".format(name),
+ "msg": "UObject {} 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}
+ mongo.db.uobjects.insert({"name": name, "datas": datas})
+ return {"msg": "UObject {} 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}
- elif len(list(mongo.db.objects.find({"name": name}))) == 0:
+ error = {"msg": "UObject name is required", "code": 400}
+ elif len(list(mongo.db.uobjects.find({"name": name}))) == 0:
error = {
- 'msg': "User {} not exist. So it's good".format(name),
+ 'msg': "UObject {} not exist. So it's good.".format(name),
"code": 404
}
if not error:
- mongo.db.objects.remove({"name": name})
- return {"msg": "Object {} deleted".format(name), "code": 200}
+ mongo.db.uobjects.remove({"name": name})
+ return {"msg": "UObject {} deleted".format(name), "code": 200}
return error