--- a/app/soc/tasks/updates/module_conversion.py Sun Oct 04 23:43:59 2009 +0200
+++ b/app/soc/tasks/updates/module_conversion.py Mon Oct 05 13:54:42 2009 +0200
@@ -36,6 +36,7 @@
from soc.logic.models.review import logic as review_logic
from soc.logic.models.student import logic as student_logic
from soc.logic.models.student_project import logic as student_project_logic
+from soc.logic.models.student_proposal import logic as student_proposal_logic
from soc.logic.models.timeline import logic as timeline_logic
from soc.tasks.helper import decorators
from soc.tasks.helper import error_handler
@@ -272,6 +273,47 @@
return
+@decorators.iterative_task(student_proposal_logic)
+def runStudentProposalUpdate(request, entities, context, *args, **kwargs):
+ """AppEngine Task that updates StudentProposal entities.
+
+ Args:
+ request: Django Request object
+ entities: list of StudentProposal entities to update
+ context: the context of this task
+ """
+
+ from soc.modules.gsoc.logic.models.mentor import logic as mentor_logic
+ from soc.modules.gsoc.logic.models.organization import logic as org_logic
+ from soc.modules.gsoc.logic.models.program import logic as program_logic
+ from soc.modules.gsoc.logic.models.student import logic as student_logic
+
+ for entity in entities:
+ entity.scope = student_logic.getFromKeyName(
+ entity.scope.key().id_or_name())
+ entity.mentor = mentor_logic.getFromKeyName(
+ entity.mentor.key().id_or_name())
+ entity.org = org_logic.getFromKeyName(entity.org.key().id_or_name())
+ entity.program = program_logic.getFromKeyName(
+ entity.program.key().id_or_name())
+
+ old_mentors = entity.possible_mentors
+ new_mentors = []
+
+ for old_mentor in old_mentors:
+ new_mentors.append(
+ mentor_logic.getFromKeyName(old_mentor.id_or_name()))
+
+ entity.possible_mentors = new_mentors
+
+ # store all StudentProposal
+ db.put(entities)
+
+ # task completed, return
+ return
+
+
+
@decorators.iterative_task(review_logic)
def runReviewUpdate(request, entities, context, *args, **kwargs):
"""AppEngine Task that updates Review entities.