Add a startSpam method to stats
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 19 Apr 2009 00:07:29 +0000
changeset 2234 69539a5ca63a
parent 2233 a20ff7087686
child 2235 d97e75574590
Add a startSpam method to stats This method creates the job responsible for sending out emails to students. Patch by: Sverre Rabbelier
scripts/stats.py
--- a/scripts/stats.py	Sun Apr 19 00:07:17 2009 +0000
+++ b/scripts/stats.py	Sun Apr 19 00:07:29 2009 +0000
@@ -256,6 +256,22 @@
     proposal_logic.updateEntityProperties(proposal, fields, silent=True)
 
 
+def startSpam():
+  from soc.logic.models.job import logic as job_logic
+  from soc.logic.models.priority_group import logic as priority_logic
+  from soc.logic.models.program import logic as program_logic
+
+  program_entity = program_logic.getFromKeyName('google/gsoc2009')
+
+  priority_group = priority_logic.getGroup(priority_logic.EMAIL)
+  job_fields = {
+      'priority_group': priority_group,
+      'task_name': 'setupStudentProposalMailing',
+      'key_data': [program_entity.key()]}
+
+  job_logic.updateOrCreateFromFields(job_fields)
+
+
 def loadPickle(name):
   """Loads a pickle.
   """
@@ -314,6 +330,7 @@
       'slotSaver': slotSaver,
       'popSaver': popSaver,
       'rawSaver': rawSaver,
+      'startSpam': startSpam,
   }
 
   interactive.remote(args, context)