removed some prints

This commit is contained in:
Aran Zaiger 2015-06-14 20:21:19 +03:00
parent d015986dfc
commit 9276e7fe02

View file

@ -168,9 +168,8 @@ def create_campus(token):
:return: :return:
code 200 code 200
""" """
print "1\n"
if not request.data: if not request.data:
return Response(response=json.dumps({'message': 'Bad Request0'}), return Response(response=json.dumps({'message': 'Bad Request'}),
status=400, status=400,
mimetype="application/json") mimetype="application/json")
payload = json.loads(request.data) payload = json.loads(request.data)
@ -187,7 +186,7 @@ def create_campus(token):
try: try:
campus = Campus(title=payload['title'], email_ending=payload['email_ending'], master_user_id=user.key().id(), avatar_url=payload['avatar_url']) campus = Campus(title=payload['title'], email_ending=payload['email_ending'], master_user_id=user.key().id(), avatar_url=payload['avatar_url'])
except Exception: except Exception:
return Response(response=json.dumps({'message': 'Bad Request1'}), return Response(response=json.dumps({'message': 'Bad Request'}),
status=400, status=400,
mimetype="application/json") mimetype="application/json")
@ -199,6 +198,55 @@ def create_campus(token):
# @app.route('/api/Courses/create/<string:token>', 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/<string:token>', methods=['GET']) @app.route('/api/Campuses/<string:token>', methods=['GET'])
@auto.doc() @auto.doc()