예제 #1
0
 def get(self):
     InitializeIfNeeded()
     stored = {}  # key/value pairs from datastore
     results = (datastore.Setting.query().filter(
         datastore.Setting.domain == datastore.CURRENT_DOMAIN).fetch())
     for result in results:
         stored[result.key.id().split(':')[1]] = result.value
     for_templ = []  # values in order for the template
     for item in CONFIGS:
         value = stored.get(item['name'], '')
         if not value and 'default' in item:
             value = item['default']
         for_templ.append({
             'name': item['name'],
             'value': value,
             'type': item['type'],
             'title': item['title'],
             'desc': item['desc'],
             'toggles': item.get('toggles', ''),
         })
     template_values = {
         'settings': for_templ,
         'current_domain': datastore.CURRENT_DOMAIN,
         'xsrf_token': xsrf.xsrf_token()
     }
     template = JINJA_ENVIRONMENT.get_template('templates/settings.html')
     self.response.write(template.render(template_values))
예제 #2
0
 def get(self):
   InitializeIfNeeded()
   stored = {}  # key/value pairs from datastore
   results = (datastore.Setting.query()
              .filter(datastore.Setting.domain == datastore.CURRENT_DOMAIN)
              .fetch())
   for result in results:
     stored[result.key.id().split(':')[1]] = result.value
   for_templ = []  # values in order for the template
   for item in CONFIGS:
     value = stored.get(item['name'], '')
     if not value and 'default' in item:
       value = item['default']
     for_templ.append({'name': item['name'],
                       'value': value,
                       'type': item['type'],
                       'title': item['title'],
                       'desc': item['desc'],
                       'toggles': item.get('toggles', ''),
                      })
   template_values = {
       'settings': for_templ,
       'current_domain': datastore.CURRENT_DOMAIN,
       'xsrf_token': xsrf.xsrf_token()
   }
   template = JINJA_ENVIRONMENT.get_template('templates/settings.html')
   self.response.write(template.render(template_values))
예제 #3
0
 def get(self):
     query = datastore.Report.all().order('-date')
     query.filter('domain =', datastore.CURRENT_DOMAIN)
     reports = query.fetch(100)
     if not reports:
         reports = None  # Conversion for templating.
     template_values = {
         'reports': reports,
         'current_domain': datastore.CURRENT_DOMAIN,
         'xsrf_token': xsrf.xsrf_token()
     }
     template = JINJA_ENVIRONMENT.get_template('templates/admin.html')
     self.response.write(template.render(template_values))
예제 #4
0
 def get(self):
   query = datastore.Report.all().order('-date')
   query.filter('domain =', datastore.CURRENT_DOMAIN)
   reports = query.fetch(100)
   if not reports:
     reports = None  # Conversion for templating.
   template_values = {
       'reports': reports,
       'current_domain': datastore.CURRENT_DOMAIN,
       'xsrf_token': xsrf.xsrf_token()
   }
   template = JINJA_ENVIRONMENT.get_template('templates/admin.html')
   self.response.write(template.render(template_values))
예제 #5
0
 def get(self):
   search_query = self.request.GET['search_query']
   (reports, report_type, host_status_name, normalized_query) = (
       self._Search(search_query))
   template_values = {
       'host_status_name': host_status_name,
       'reports': reports,
       'report_type': report_type,
       'search_query': normalized_query,
       'current_domain': datastore.CURRENT_DOMAIN,
       'xsrf_token': xsrf.xsrf_token()
   }
   template = JINJA_ENVIRONMENT.get_template('templates/admin.html')
   self.response.write(template.render(template_values))