From 4bb17157d0eebebc0d2d97594cbfb0fbea43cd5f Mon Sep 17 00:00:00 2001 From: aranzaiger Date: Tue, 16 Jun 2015 22:28:05 +0300 Subject: [PATCH] fix updateUser - added save ro DB fix parameter name fix documentation --- SE_API/UserRoutes.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/SE_API/UserRoutes.py b/SE_API/UserRoutes.py index f1e9382..4073229 100644 --- a/SE_API/UserRoutes.py +++ b/SE_API/UserRoutes.py @@ -83,8 +83,8 @@ def updateUser(token): Payload
- JSON Object, Example:
{
- 'name': 'Campus name',
- 'isLecturer': '@campus.ac.com',
+ 'name': 'new name',
+ 'isLecturer': true
}

Response @@ -100,23 +100,24 @@ def updateUser(token): try: payload = json.loads(request.data) except Exception as e: - return bad_request(e) + return bad_request() user = get_user_by_token(token) if user is None: return bad_request("Not a user!") try: - user.name = payload['user'] + user.name = payload['name'] except Exception: pass try: user.isLecturer = payload['isLecturer'] - except Exception: - pass - + except Exception as e: + print e + db.put(user) + db.save return ok("User updated")