# HG changeset patch # User Lennard de Rijk # Date 1255878601 -7200 # Node ID 1ffc7cd7309cdcd99e29e84f9f2ef024bf048129 # Parent e21d0f9bcecd3e0d1f14917313fb880184853caa Fixed the TimelineConversionUpdate to also update the GSoCProgram. diff -r e21d0f9bcecd -r 1ffc7cd7309c app/soc/tasks/updates/module_conversion.py --- a/app/soc/tasks/updates/module_conversion.py Sun Oct 18 17:00:37 2009 +0200 +++ b/app/soc/tasks/updates/module_conversion.py Sun Oct 18 17:10:01 2009 +0200 @@ -536,6 +536,8 @@ def runTimelineConversionUpdate(request, entities, context, *args, **kwargs): """AppEngine Task that converts Timelines into GSoCTimelines. + It also updates all GSoCPrograms with a reference to the new GSoCTimeline. + Args: request: Django Request object entities: list of Timeline entities to convert @@ -549,8 +551,9 @@ timeline_model = timeline_logic.getModel() timeline_properties = timeline_model.properties().keys() - # use this to store all the new GSoCTimelines - gsoc_timeline = [] + # use this to store all the new GSoCTimelines and GSoCPrograms + gsoc_timelines = [] + gsoc_programs = [] for entity in entities: gsoc_properties = {} @@ -559,7 +562,7 @@ # copy over all the information from the timeline entity gsoc_properties[timeline_property] = getattr(entity, timeline_property) - gsoc_program = program_logic.getFromKeyName(entity.scope.key().id_or_name()) + gsoc_program = program_logic.getFromKeyName(entity.key().id_or_name()) gsoc_properties['scope'] = gsoc_program # create the new GSoCTimeline entity and prepare it to be stored @@ -567,8 +570,13 @@ **gsoc_properties) gsoc_timelines.append(gsoc_timeline_entity) - # store all the new GSoCPrograms + # set the timeline for the GSoCProgram entity and prepare it for storage + gsoc_program.timeline = gsoc_timeline_entity + gsoc_programs.append(gsoc_program) + + # store all the new GSoCTimelines and GSoCPrograms db.put(gsoc_timelines) + db.put(gsoc_programs) # task completed, return return