Exemplo n.º 1
0
  def get(self):
    # Require users to be logged to see builder alerts from private/internal
    # trees.
    queries = []
    for grp in filter(auth.is_group_member, self.GROUPS):
      queries.append(Tree.query(Tree.group == grp).fetch_async())

    all_trees = []
    for trees in queries:
      all_trees.extend(trees.get_result())

    # So that chromium is the default
    all_trees.sort(key=lambda t: not t.key.string_id() == "chromium")

    serialized = [{
        'name': tree.key.string_id(),
        'display_name': tree.display_name,
        'bug_labels': tree.bug_labels,
    } for tree in all_trees]

    data = utils.generate_json_dump({'trees': serialized})
    self.send_json_headers()
    self.response.write(data)
Exemplo n.º 2
0
 def write_json(self, data):
     self.response.headers["Access-Control-Allow-Origin"] = "*"
     self.response.headers["Content-Type"] = "application/json"
     data = utils.generate_json_dump(data)
     self.response.write(data)
Exemplo n.º 3
0
 def set_memcache(self, key, data):
     json_data = utils.generate_json_dump(data, False)
     compression_level = self.MEMCACHE_COMPRESSION_LEVEL
     compressed = zlib.compress(json_data, compression_level)
     memcache.set(key, compressed)