Changeset 12869 for main/waeup.kofa/trunk/src/waeup/kofa/university
- Timestamp:
- 22 Apr 2015, 19:14:14 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/university
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/university/batching.py
r11891 r12869 44 44 45 45 class FacultyProcessor(BatchProcessor): 46 """A batch processor for IFaculty objects. 46 """The Faculty Processor processes faculties in the `faculties` container. 47 The `FacultyProcessor` class also serves as a baseclass for all other 48 batch processors in the academic section. 49 50 The processor makes some efforts to set local roles. 51 If new roles are provided, the `updateEntry` method first removes 52 all existing roles and then sets the new roles as given in the import 53 file. That means the entire set of local roles is replaced. 47 54 """ 48 55 grok.implements(IBatchProcessor) … … 103 110 role_map = IPrincipalRoleMap(obj) 104 111 # Remove all existing local roles. 105 for local_role, user_name, setting in role_map.getPrincipalsAndRoles(): 112 for local_role, user_name, setting in \ 113 role_map.getPrincipalsAndRoles(): 106 114 role_manager.unsetRoleForPrincipal(local_role, user_name) 107 115 notify(LocalRoleSetEvent( … … 114 122 local_role = rolemap['local_role'] 115 123 role_manager.assignRoleToPrincipal(local_role, user) 116 notify(LocalRoleSetEvent(obj, local_role, user, granted=True)) 117 items_changed += ( 118 '%s=%s, ' % ('local_roles', '%s|%s' % (user,local_role))) 124 notify(LocalRoleSetEvent( 125 obj, local_role, user, granted=True)) 126 items_changed += ('%s=%s, ' 127 % ('local_roles', '%s|%s' % (user,local_role))) 119 128 row.pop('local_roles') 120 129 … … 151 160 if not 'user_name' in rolemap.keys() or not \ 152 161 'local_role' in rolemap.keys(): 153 errs.append(('local_roles','user_name or local_role missing')) 162 errs.append(( 163 'local_roles','user_name or local_role missing')) 154 164 return errs, inv_errs, conv_dict 155 165 local_role = rolemap['local_role'] … … 165 175 166 176 class DepartmentProcessor(FacultyProcessor): 167 """A batch processor for IDepartment objects. 177 """The Department Processor works in the same way as the Faculty 178 Processor. Since department codes are not necessarily unique, it needs the 179 `faculty_code` to create and update objects. 168 180 """ 169 181 grok.implements(IBatchProcessor) … … 213 225 214 226 class CertificateProcessor(FacultyProcessor): 215 """A batch processor for ICertificate objects. 227 """The Certificate Processor gets the parent object (the 228 `certificates` attribute of the department container) in two ways. 229 If both faculty and department codes are provided, `getPartents` uses 230 these to locate the certificate. If department code or 231 faculty code are missing, it use the certificates catalog to find the 232 certificate. 216 233 """ 217 234 grok.implements(IBatchProcessor) … … 270 287 return dept.certificates 271 288 # If department code or faculty code is missing, 272 # use catalog to get parent. Makes only sense in update mode but 273 # does also work in create mode. 289 # use catalog to get parent. 274 290 cat = queryUtility(ICatalog, name='certificates_catalog') 275 291 results = list( … … 296 312 297 313 class CourseProcessor(CertificateProcessor): 298 """A batch processor for ICourse objects. 314 """The Course Processor works exactly in the same way as the 315 Certificate Processor. It uses the courses catalog instead of the 316 certificates catalog. 299 317 """ 300 318 grok.implements(IBatchProcessor) … … 343 361 344 362 class CertificateCourseProcessor(FacultyProcessor): 345 """A batch processor for ICertificateCourse objects. 363 """The Certificate Course Processor needs more location fields. 364 Certificate courses are stored inside the certificate container. 365 Thus, `faculty_code`, `department_code` and the 366 `certificate_code` are necessary to find the parent container. 367 It furthermore needs the `course` and the `level` field to locate 368 existing objects as they are part of the object id (code). 346 369 """ 347 370 grok.implements(IBatchProcessor) -
main/waeup.kofa/trunk/src/waeup/kofa/university/export.py
r12858 r12869 26 26 27 27 class FacultyExporter(grok.GlobalUtility, ExporterBase): 28 """The Faculty Exporter exports all faculties in the 'faculties'28 """The Faculty Exporter exports all faculties in the `faculties` 29 29 container. This is the only place where faculties are stored. 30 30 """
Note: See TracChangeset for help on using the changeset viewer.