From 9276e7fe02018b48e738f377e5ad88304881d9f9 Mon Sep 17 00:00:00 2001 From: aranzaiger Date: Sun, 14 Jun 2015 20:21:19 +0300 Subject: [PATCH] removed some prints --- SE_API/API.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/SE_API/API.py b/SE_API/API.py index d203ddc..6732abe 100644 --- a/SE_API/API.py +++ b/SE_API/API.py @@ -168,9 +168,8 @@ def create_campus(token): :return: code 200 """ - print "1\n" if not request.data: - return Response(response=json.dumps({'message': 'Bad Request0'}), + return Response(response=json.dumps({'message': 'Bad Request'}), status=400, mimetype="application/json") payload = json.loads(request.data) @@ -187,7 +186,7 @@ def create_campus(token): try: campus = Campus(title=payload['title'], email_ending=payload['email_ending'], master_user_id=user.key().id(), avatar_url=payload['avatar_url']) except Exception: - return Response(response=json.dumps({'message': 'Bad Request1'}), + return Response(response=json.dumps({'message': 'Bad Request'}), status=400, mimetype="application/json") @@ -199,6 +198,55 @@ def create_campus(token): +# @app.route('/api/Courses/create/', methods=['POST']) +# @auto.doc() +# def create_course(token): +# """ +# This call will create a new campus in the DB +# :param token: user seToken +# Payload +# { +# 'courseName': self.courseName, +# 'campusName': self.campusName, +# 'projects': self.projects +# 'startDate': self.startDate +# 'endDate': self.endDate +# 'taskFlag': self.taskFlag +# } +# +# :return: +# code 200 +# """ +# if not request.data: +# return Response(response=json.dumps({'message': 'Bad Request'}), +# status=400, +# mimetype="application/json") +# payload = json.loads(request.data) +# if not is_lecturer(token): #todo: change to lecturer id +# return Response(response=json.dumps({'message': 'Invalid token or not a lecturer!'}), +# status=403, +# mimetype="application/json") +# +# user = get_user_by_token(token) +# +# #todo: check legality +# +# +# try: +# course = Course(courseName=payload['courseName'], campusName=payload['campusName'], projects=payload['projects'], startDate=payload['startDate'], endDate=payload['endDate'], taskFlag=payload['taskFlag']) +# except Exception: +# return Response(response=json.dumps({'message': 'Bad Request'}), +# status=400, +# mimetype="application/json") +# +# db.put(course) +# db.save +# return Response(response=json.dumps(course.to_JSON()), +# status=200, +# mimetype="application/json") +# +# +# @app.route('/api/Campuses/', methods=['GET']) @auto.doc()