373 } |
373 } |
374 |
374 |
375 return properties |
375 return properties |
376 |
376 |
377 |
377 |
|
378 def seed_org(request, i): |
|
379 """Returns the properties for a new org entity. |
|
380 """ |
|
381 |
|
382 account, current_user = ensureUser() |
|
383 gsoc2009 = Program.get_by_key_name('google/gsoc2009') |
|
384 |
|
385 if not gsoc2009: |
|
386 raise Error('Run seed_db first') |
|
387 |
|
388 properties = { |
|
389 'key_name': 'google/gsoc2009/%d' % i, |
|
390 'link_id': 'org_%d' % i, |
|
391 'name': 'Organization %d' % i, |
|
392 'short_name': 'Org %d' % i, |
|
393 'founder': current_user, |
|
394 'scope_path': 'google/gsoc2009', |
|
395 'scope': gsoc2009, |
|
396 'email': 'org_%i@example.com' % i, |
|
397 'home_page': 'http://code.google.com/p/soc', |
|
398 'description': 'Melange, share the love!', |
|
399 'license_name': 'Apache License', |
|
400 'contact_street': 'Some Street', |
|
401 'contact_city': 'Some City', |
|
402 'contact_country': 'United States', |
|
403 'contact_postalcode': '12345', |
|
404 'phone': '1-555-BANANA', |
|
405 'ideas': 'http://code.google.com/p/soc/issues', |
|
406 } |
|
407 |
|
408 return properties |
|
409 |
|
410 |
378 def seed_many(request, *args, **kwargs): |
411 def seed_many(request, *args, **kwargs): |
379 """Seeds many instances of the specified type. |
412 """Seeds many instances of the specified type. |
380 """ |
413 """ |
381 |
414 |
382 get_args = request.GET |
415 get_args = request.GET |
384 if not dicts.containsAll(get_args, ['goal', 'start', 'end', 'seed_type']): |
417 if not dicts.containsAll(get_args, ['goal', 'start', 'end', 'seed_type']): |
385 return http.HttpResponse('Missing get args.') |
418 return http.HttpResponse('Missing get args.') |
386 |
419 |
387 seed_types = { |
420 seed_types = { |
388 'user': (seed_user, User), |
421 'user': (seed_user, User), |
|
422 'org': (seed_org, Organization), |
389 } |
423 } |
390 |
424 |
391 goal = int(get_args['goal']) |
425 goal = int(get_args['goal']) |
392 start = int(get_args['start']) |
426 start = int(get_args['start']) |
393 end = int(get_args['end']) |
427 end = int(get_args['end']) |