예제 #1
0
def _getAllOrgAdmins():
  """Returns a generator of all active mentors.
  """

  from soc.models.org_admin import OrgAdmin

  gen = lambda: OrgAdmin.all().filter('status = ', 'active')
  return interactive.deepFetch(gen)
예제 #2
0
def _getAllOrgAdmins():
    """Returns a generator of all active mentors.
  """

    from soc.models.org_admin import OrgAdmin

    gen = lambda: OrgAdmin.all().filter('status = ', 'active')
    return interactive.deepFetch(gen)
예제 #3
0
파일: seed_db.py 프로젝트: ajaksu/Melange
def clear(*args, **kwargs):
  """Removes all entities from the datastore.
  """

  # there no explicit ranker model anywhere, so make one for
  # our own convenience to delete all rankers
  class ranker(db.Model):
    """ranker model used with ranklist module.
    """
    pass

  # TODO(dbentley): If there are more than 1000 instances of any model,
  # this method will not clear all instances.  Instead, it should continually
  # call .all(), delete all those, and loop until .all() is empty.
  entities = itertools.chain(*[
      Notification.all(),
      Mentor.all(),
      Student.all(),
      OrgAdmin.all(),
      ranker.all(),
      RankerRoot.all(),
      StudentProposal.all(),
      Organization.all(),
      OrgApplication.all(),
      Timeline.all(),
      Program.all(),
      Host.all(),
      Sponsor.all(),
      User.all(),
      Site.all(),
      Document.all(),
      ])

  try:
    for entity in entities:
      entity.delete()
  except db.Timeout:
    return http.HttpResponseRedirect('#')
  # pylint: disable-msg=E1101
  memcache.flush_all()

  return http.HttpResponse('Done')