Esempio n. 1
0
File: home.py Progetto: ih/focusbell
 def post(self):
     # todo it'd be nice to process the request data as json
     was_focused = False
     if self.request.get("was_focused") == "true":
         was_focused = True
     session = FocusSession.get(self.request.get("session"))
     interval = int(self.request.get("interval"))
     alert = Alert(was_focused=was_focused, session=session, interval=interval)
     alert.put()
Esempio n. 2
0
File: home.py Progetto: ih/focusbell
 def post(self):
     user = users.get_current_user()
     # use the last interval from the previous session as the first interval in the current session
     if user:
         # create a new session
         initial_interval = Alert.last_interval(user)
         session = FocusSession()
         key = session.put()
         template_values = {"session_key": key, "interval": initial_interval}
         render(self, "stop.html", template_values)
     else:
         self.redirect(users.create_login_url(self.request.uri))