120 |
120 |
121 for org_property in org_properties: |
121 for org_property in org_properties: |
122 # copy over all the information from the Organization entity |
122 # copy over all the information from the Organization entity |
123 gsoc_properties[org_property] = getattr(entity, org_property) |
123 gsoc_properties[org_property] = getattr(entity, org_property) |
124 |
124 |
125 # get the Program key belonging to the old Organization |
125 # get the Program key belonging to the old Organization |
126 program_key = entity.scope.key().id_or_name() |
126 program_key = entity.scope.key().id_or_name() |
127 # get the new GSoCProgram and set it as scope for the GSoCOrganzation |
127 # get the new GSoCProgram and set it as scope for the GSoCOrganzation |
128 gsoc_program = gsoc_program_logic.getFromKeyName(program_key) |
128 gsoc_program = gsoc_program_logic.getFromKeyName(program_key) |
129 gsoc_properties['scope'] = gsoc_program |
129 gsoc_properties['scope'] = gsoc_program |
130 |
130 |
131 # create the new GSoCOrganization entity and prepare it to be stored |
131 # create the new GSoCOrganization entity and prepare it to be stored |
132 gsoc_org_entity = GSoCOrganization(key_name=entity.key().name(), |
132 gsoc_org_entity = GSoCOrganization(key_name=entity.key().name(), |
133 **gsoc_properties) |
133 **gsoc_properties) |
134 gsoc_orgs.append(gsoc_org_entity) |
134 gsoc_orgs.append(gsoc_org_entity) |
196 |
196 |
197 for role_property in role_properties: |
197 for role_property in role_properties: |
198 # copy over all the information from the Role entity |
198 # copy over all the information from the Role entity |
199 gsoc_properties[role_property] = getattr(entity, role_property) |
199 gsoc_properties[role_property] = getattr(entity, role_property) |
200 |
200 |
201 # get the Program key belonging to the old Role |
201 # get the Program key belonging to the old Role |
202 program_key = entity.program.key().id_or_name() |
202 program_key = entity.program.key().id_or_name() |
203 # get the new GSoCProgram and set it for the Role |
203 # get the new GSoCProgram and set it for the Role |
204 gsoc_program = gsoc_program_logic.getFromKeyName(program_key) |
204 gsoc_program = gsoc_program_logic.getFromKeyName(program_key) |
205 gsoc_properties['program'] = gsoc_program |
205 gsoc_properties['program'] = gsoc_program |
206 |
206 |
207 # get the Organization key belonging to the old Role |
207 # get the Organization key belonging to the old Role |
208 org_key = entity.scope.key().id_or_name() |
208 org_key = entity.scope.key().id_or_name() |
209 # get the new GSoCOrganization and set it as scope for the Role |
209 # get the new GSoCOrganization and set it as scope for the Role |
210 gsoc_org = gsoc_org_logic.getFromKeyName(org_key) |
210 gsoc_org = gsoc_org_logic.getFromKeyName(org_key) |
211 gsoc_properties['scope'] = gsoc_org |
211 gsoc_properties['scope'] = gsoc_org |
212 |
212 |
213 # create the new GSoC Role entity and prepare it to be stored |
213 # create the new GSoC Role entity and prepare it to be stored |
214 gsoc_role_entity = to_role_model(key_name=entity.key().name(), |
214 gsoc_role_entity = to_role_model(key_name=entity.key().name(), |
215 **gsoc_properties) |
215 **gsoc_properties) |
216 gsoc_roles.append(gsoc_role_entity) |
216 gsoc_roles.append(gsoc_role_entity) |