def get(self):
    # Force all transactions to complete to show the user consistent results.
    datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3')
    datastore_stub.Flush()

    kind = self.request.get('kind', None)
    namespace = self.request.get('namespace', '')
    order = self.request.get('order', None)
    message = self.request.get('message', None)

    try:
      page = int(self.request.get('page', '1'))
    except ValueError:
      page = 1

    kinds = self._get_kinds(namespace)
    if not kind and kinds:
      self.redirect(self._construct_url(add={'kind': kinds[0]}))
      return

    if kind:
      start = (page-1) * self.NUM_ENTITIES_PER_PAGE
      headers, template_entities, total_entities = (
          self._get_entity_template_data(
              self.request.uri,
              kind,
              namespace,
              order,
              start))
      num_pages = int(math.ceil(float(total_entities) /
                                self.NUM_ENTITIES_PER_PAGE))
    else:
      start = 0
      headers = []
      template_entities = []
      total_entities = 0
      num_pages = 0

    select_namespace_url = self._construct_url(
        remove=['message'],
        add={'namespace': self.request.get('namespace')})
    self.response.write(self.render(
        'datastore_viewer.html',
        {'entities': template_entities,
         'headers': headers,
         'kind': kind,
         'kinds': kinds,
         'message': message,
         'namespace': namespace,
         'num_pages': num_pages,
         'order': order,
         'order_base_url': self._construct_url(remove=['message', 'order']),
         'page': page,
         'paging_base_url': self._construct_url(remove=['message', 'page']),
         'select_namespace_url': select_namespace_url,
         'show_namespace': self.request.get('namespace', None) is not None,
         'start': start,
         'total_entities': total_entities}))
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/admin/datastore_viewer.py/DatastoreRequestHandler.get/original