Пример #1
0
    def get(self):
        sta = Statistics.all()
#        sta.order("-mtime")
        for s in sta:
            if not s.addr:
                s.addr = addr.ip2addr(s.ip)
                s.put()
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('ok')
Пример #2
0
 def get(self):
     ip = self.request.remote_addr
     user = users.get_current_user()
     if not user or not users.is_current_user_admin():
         self.redirect(users.create_login_url(self.request.uri))
     template_values = {'user': user,}
     sta = Statistics.all()
     sta.order("-mtime")
     uids = []
     for s in sta.fetch(100):
         if not s.addr:
             s.addr = addr.ip2addr(s.ip)
             s.put()
         uids.append({'uid':s.uid,'ip':s.ip,'mtime':s.mtime+datetime.timedelta(hours=8),
             'url':s.url,'user_agent':s.user_agent,'addr':s.addr})
     template_values.update({'statistics':uids})
     template = JINJA_ENVIRONMENT.get_template('admin.html')
     self.response.write(template.render(template_values))