示例#1
0
文件: home.py 项目: 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()
示例#2
0
文件: home.py 项目: 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))