Beispiel #1
0
 def get(self):
   user = GaeUser.query().get()
   if not user:
     raise RuntimeError('user not saved in datasotre, run /fetch_calendar first')
   user_email = user.email
   start_date = datetime_util.yesterday()
   start_date_text = datetime_util.date_to_str(start_date)
   taskqueue.add(url='/calendar_fetch_worker',
                 params={'user_email': user_email, 'date': start_date_text})
   self.response.write('<p>Launched fetch with user_email: %s on %s</p>' %
       (user_email, start_date_text))
Beispiel #2
0
 def get(self):
   user = GaeUser.query().get()
   if not user:
     raise RuntimeError('user not saved in datasotre, run /fetch_calendar first')
   user_email = user.email
   service = TimelogEventService(user)
   failed_history_list = service.query_failed_history_list()
   for failed_history in failed_history_list:
     date_text = datetime_util.date_to_str(failed_history.date)
     taskqueue.add(url='/calendar_fetch_worker',
                   params={'user_email': user_email, 'date': date_text})
     self.response.write('<p>Launched fetch with user_email: %s on %s</p>' %
         (user_email, date_text))
Beispiel #3
0
  def get(self):
    user_email = GaeUser.query().get().email
    if not user_email:
      raise RuntimeError('user_email not saved in datasotre, run /fetch_calendar first')
    date = datetime_util.yesterday()
    logs = FetchLog.query().filter(FetchLog.date == date).fetch()
    content = ''
    if len(logs) == 0:
      content = 'No fetch log can be found.'
    else:
      content = '\n'.join([log.description for log in logs])

    mail.send_mail(
      'noreply@%s.appspotmail.com' % (
        app_identity.get_application_id()), #from
      '*****@*****.**', #TODO: to use real user email.
      '%s fetch logs' % date.isoformat(),
      content
    )