Ignore:
Timestamp:
22 Apr 2015, 19:14:14 (10 years ago)
Author:
Henrik Bettermann
Message:

Start documenting batch processors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py

    r11891 r12869  
    3535
    3636class ApplicantsContainerProcessor(BatchProcessor):
    37     """A processor for applicants containers.
     37    """The Applicants Container Processor imports containers for applicants.
     38    It does not import their content. There is nothing special about this
     39    processor.
    3840    """
    3941    grok.implements(IBatchProcessor)
     
    7678
    7779class ApplicantProcessor(BatchProcessor):
    78     """A batch processor for IApplicant objects.
    79 
    80     In create mode container_code is required. If application_number is given
    81     an applicant with this number is created in the designated container.
    82     If application_number is not given a random application_number is assigned.
    83     applicant_id is being determined by the system and can't be imported.
    84 
    85     In update or remove mode container_code and application_number columns
    86     must not exist. The applicant object is solely searched by its applicant_id
    87     or reg_number.
     80    """The Applicant Processor imports application records (applicants).
     81
     82    In create mode `container_code` is required. If `application_number` is
     83    given, an applicant with this number is created in the designated container.
     84    If `application_number` is not given, a random `application_number` is
     85    assigned. `applicant_id` is being determined by the system and can't be
     86    imported.
     87
     88    In update or remove mode `container_code` and `application_number` columns
     89    must not exist. The applicant object is solely localized by
     90    `applicant_id` or `reg_number`.
    8891    """
    8992    grok.implements(IBatchProcessor)
     
    9598    iface = IApplicant
    9699    iface_byregnumber = IApplicantUpdateByRegNo
    97     location_fields = ['']
    98100    factory_name = 'waeup.Applicant'
    99101
     
    303305        if cert is not None and (mode in ('create', 'update')):
    304306            # course1 application category must match container's.
    305             parent = self.getParent(row, self.site)
     307            site = grok.getSite()
     308            parent = self.getParent(row, site)
    306309            if parent is None:
    307310                errs.append(('container', 'not found'))
     
    332335            return 'Applicant is blocked.'
    333336        return None
    334 
    335     def doImport(self, *args, **kw):
    336         # XXX: Not thread-safe.  Parallel applicant imports into
    337         # different sites could mean a mess.  Luckily this is not a
    338         # typical use-case. On the other hand it spares thousands of
    339         # site lookups during large imports.
    340         # XXX: Maybe this should go into Importer base.
    341         self.site = grok.getSite() # needed by checkConversion()
    342         return super(ApplicantProcessor, self).doImport(*args, **kw)
Note: See TracChangeset for help on using the changeset viewer.