def get(self): try: first = int(self.request.get('first')) second = int(self.request.get('second')) self.response.write(str(first + second)) except Exception as e: self.response.write("invalid inputs. "+ str(e)+ " user "+UserController.loadUser(self)) pass stud = UserController.getStudient(self) studID = stud.getID() self.mySum = Sum(studID,first,second, first+second) self.mySum.store()
def get(self): userName = UserController.loadUser(self,self.request.uri) # user = users.get_current_user() # if not user: # self.redirect(users.create_login_url(self.request.uri)) # else: # userName = user.nickname() # if "@" in user.nickname(): # userName = userName[:user.nickname().find("@")] # else: # userName = user.nickname() # myStudient = Studient.getStudientByName(userName) # if not myStudient: # myNewStudient = Studient(userName) # myNewStudient.store() templateValues = { 'source': "Template", 'jQuerySource': JQUERY_SOURCE, 'userName': userName } mainPageTemplate = os.path.join(os.path.dirname(__file__), 'Views/MainPage.html') self.response.write(render(mainPageTemplate, templateValues))
def post(self): data = parser.parse_args() print(data) access_token, refresh_token = UserController.login( codeCollection, data) return { "access_token": access_token, "refresh_token": refresh_token }
def post(self): access_token = request.json['access_token'] print(get_jwt_identity()) return UserController.currentEntity(access_token)
def list_of_save_article(user_id): response = UserController.article_list(user_id) return respondWithArray(response, 'mini_transformer')
def remove_article_form_user(user_id, article_id): response = UserController.remove_article(user_id, article_id) if response: return respondOk('Removed Successfully') return respondWithError('Failed to remove')
def save_article_for_user(user_id, article_id): response = UserController.save_article(user_id, article_id) if response: return respondOk('Saved Successfully') return respondWithError('Failed to save')
def get(self): stud = UserController.getStudient(self) self.sums = stud.getAllSums() for self.sum in self.sums: self.response.write("<p>%s+%s=%s</p>" % (self.sum.getN1(),self.sum.getN2(),self.sum.getResult()))
def user_signup(): json_data = request.get_json() return UserController.signup(json_data['username'], json_data['password'], json_data['email'], json_data['firstname'], json_data['lastname'])
def user_login(): json_data = request.get_json() return UserController.login(json_data['username'], json_data['password'])