Changeset 8996


Ignore:
Timestamp:
13 Jul 2012, 10:52:33 (12 years ago)
Author:
Henrik Bettermann
Message:

Derive all Processors from FacultyProcessor? to reuse updateEntry and checkConversion.

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

    r8995 r8996  
    3636    IFacultiesContainer, IFaculty, ICourse, IDepartment, ICertificate,
    3737    ICertificateCourse)
    38 from waeup.kofa.university.faculty import Faculty
     38from waeup.kofa.university import (
     39    Faculty, Department, Course, Certificate)
    3940from waeup.kofa.utils.batching import BatchProcessor
    4041
     
    6465        fields = getFields(self.iface)
    6566        return sorted(list(set(
    66             ['local_roles'] + fields.keys())))
     67            self.location_fields + fields.keys() + ['local_roles']
     68            )))
    6769
    6870    def entryExists(self, row, site):
     
    147149        return errs, inv_errs, conv_dict
    148150
    149 class DepartmentProcessor(BatchProcessor):
     151class DepartmentProcessor(FacultyProcessor):
    150152    """A batch processor for IDepartment objects.
    151153    """
     
    158160    name = u'Department Processor'
    159161    iface = IDepartment
     162    allowed_roles = Department.local_roles
    160163
    161164    location_fields = ['code', 'faculty_code']
     
    194197        return
    195198
    196 class CourseProcessor(BatchProcessor):
     199class CourseProcessor(FacultyProcessor):
    197200    """A batch processor for ICourse objects.
    198201    """
     
    205208    name = u'Course Processor'
    206209    iface = ICourse
     210    allowed_roles = Course.local_roles
    207211
    208212    location_fields = ['code', 'faculty_code', 'department_code']
     
    245249        return
    246250
    247 class CertificateProcessor(BatchProcessor):
     251class CertificateProcessor(FacultyProcessor):
    248252    """A batch processor for ICertificate objects.
    249253    """
     
    256260    name = u'Certificate Processor'
    257261    iface = ICertificate
     262    allowed_roles = Certificate.local_roles
    258263
    259264    location_fields = ['code']
     
    266271        fields = getFields(self.iface)
    267272        return sorted(list(set(
    268             ['faculty_code','department_code'] + fields.keys())))
     273            ['faculty_code','department_code'] + fields.keys()
     274            + ['local_roles'])))
    269275
    270276    def checkHeaders(self, headerfields, mode='create'):
     
    339345        return
    340346
    341 class CertificateCourseProcessor(BatchProcessor):
     347class CertificateCourseProcessor(FacultyProcessor):
    342348    """A batch processor for ICertificateCourse objects.
    343349    """
  • main/waeup.kofa/trunk/src/waeup/kofa/university/course.py

    r8920 r8996  
    2929    """
    3030    grok.implements(ICourse, ICourseAdd)
     31
     32    local_roles = []
    3133
    3234    def __init__(self,
Note: See TracChangeset for help on using the changeset viewer.