app/soc/models/seed_db.py
changeset 2361 40b0c25a5793
parent 2352 33ff03da52b6
child 2366 1a954e80d444
equal deleted inserted replaced
2360:e389d26949db 2361:40b0c25a5793
   498   notes_document = Document(**document_properties)
   498   notes_document = Document(**document_properties)
   499   notes_document.put()
   499   notes_document.put()
   500 
   500 
   501   site.home = home_document
   501   site.home = home_document
   502   site.put()
   502   site.put()
   503 
   503   # pylint: disable-msg=E1101
   504   memcache.flush_all()
   504   memcache.flush_all()
   505 
   505 
   506   return http.HttpResponse('Done')
   506   return http.HttpResponse('Done')
   507 
   507 
   508 
   508 
   599   _, current_user = ensureUser()
   599   _, current_user = ensureUser()
   600   org = Organization.get_by_key_name('google/gsoc2009/org_%d' % i)
   600   org = Organization.get_by_key_name('google/gsoc2009/org_%d' % i)
   601 
   601 
   602   if not org:
   602   if not org:
   603     raise Error('Run seed_many for at least %d orgs first.' % i)
   603     raise Error('Run seed_many for at least %d orgs first.' % i)
   604 
   604   
       
   605   # pylint: disable-msg=E1103
   605   properties = {
   606   properties = {
   606       'key_name': 'google/gsoc2009/org_%d/mentor' % i,
   607       'key_name': 'google/gsoc2009/org_%d/mentor' % i,
   607       'link_id': 'mentor',
   608       'link_id': 'mentor',
   608       'scope': org,
   609       'scope': org,
   609       'scope_path': org.key().id_or_name(),
   610       'scope_path': org.key().id_or_name(),
   691 
   692 
   692   if not mentor:
   693   if not mentor:
   693     raise Error('Run seed_many for at least %d mentors first.' % i)
   694     raise Error('Run seed_many for at least %d mentors first.' % i)
   694 
   695 
   695   all_properties = []
   696   all_properties = []
   696 
   697   
       
   698   # pylint: disable-msg=E1103
   697   for i in range(random.randint(5, 20)):
   699   for i in range(random.randint(5, 20)):
   698     link_id = 'proposal_%s_%d' % (org.link_id, i)
   700     link_id = 'proposal_%s_%d' % (org.link_id, i)
   699     scope_path = 'google/gsoc2009/' + user.link_id
   701     scope_path = 'google/gsoc2009/' + user.link_id
   700 
   702 
   701     properties = {
   703     properties = {
   896   try:
   898   try:
   897     for entity in entities:
   899     for entity in entities:
   898       entity.delete()
   900       entity.delete()
   899   except db.Timeout:
   901   except db.Timeout:
   900     return http.HttpResponseRedirect('#')
   902     return http.HttpResponseRedirect('#')
   901 
   903   # pylint: disable-msg=E1101
   902   memcache.flush_all()
   904   memcache.flush_all()
   903 
   905 
   904   return http.HttpResponse('Done')
   906   return http.HttpResponse('Done')
   905 
   907 
   906 
   908