fix updateUser - added save ro DB

fix parameter name
                             fix documentation
This commit is contained in:
Aran Zaiger 2015-06-16 22:28:05 +03:00
parent d428da5df0
commit 4bb17157d0

View file

@ -83,8 +83,8 @@ def updateUser(token):
<b>Payload</b><br>
- JSON Object, Example: <br>
{<br>
'name': 'Campus name',<br>
'isLecturer': '@campus.ac.com',<br>
'name': 'new name',<br>
'isLecturer': true<br>
}<br>
<br>
<b>Response</b>
@ -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")