示例#1
0
  def get(self):
    user_id = users.get_current_user().user_id()
    user_email = users.get_current_user().email()
    user_key = ndb.Key(GaeUser, user_email)
    if not user_key.get():
      GaeUser(key = user_key, id = user_id, email = user_email).put()

    if self.request.get('start_date'):
      start_date = datetime_util.parse_date(self.request.get('start_date'))
    else:
      start_date = datetime_util.yesterday()
    today = datetime_util.today()
    while start_date < today:
      taskqueue.add(url='/calendar_fetch_worker',
                    params={'user_email': user_email,
                            'date': datetime_util.date_to_str(start_date)})
      self.response.write('<p>Launched fetch with user_email: %s on %s</p>' %
          (user_email, start_date.isoformat()))
      start_date = datetime_util.one_day_later(start_date)
 def _log(self, text, _logtype='info'):
   if _logtype == 'info':
     logging.info(text)
   FetchLog(parent = self.user_key, date = datetime_util.today(), description = text).put()