Paste #82

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def get_schema_kinds():
  """Returns the list of kinds for this app."""

  class KindStatError(Exception):
    """Unable to find kind stats for an all-kinds download."""
    pass

  from google.appengine.ext.db import stats
  global_stat = stats.GlobalStat.all().get()
  if not global_stat:
    raise KindStatError()
  timestamp = global_stat.timestamp
  kind_stat = stats.KindStat.all().filter("timestamp =", timestamp).fetch(1000)
  # kind_stat = stats.KindStat.all().fetch(1000) # Experimental                                                                                                  
  kind_list = [stat.kind_name for stat in kind_stat
               if stat.kind_name and not stat.kind_name.startswith('__')]
  kind_set = set(kind_list)
  return list(kind_set)