def post(self): user_email = self.request.get("email") user_country = self.request.get("country") user_email_ok = User.validate_email(user_email) user_country_ok = User.validate_country(user_country) if user_email_ok and user_country_ok: user = self.current_user user.email = user_email user.country = user_country user.put() # Redirect users to the page they came from or the page they're supposed to head to next = self.session.get("next") redirect = self.session.get("referer") if next: redirect = next self.redirect(str(redirect)) else: # Display the form again values = { "countries": User.get_countries(), } path = "complete.html" self.render(path, values)
def get(self): if self.current_user and self.current_user.email is None: values = { "countries": User.get_countries(), } path = "complete.html" self.render(path, values) else: self.redirect("/")
def get(self): countries = User.get_countries() for c in countries: c["selected"] = False if c["code"] == self.current_user.country: c["selected"] = True values = { "countries": countries } path = "settings.html" self.render(path, values)