Ignore:
Timestamp:
20 Dec 2014, 15:59:04 (10 years ago)
Author:
Henrik Bettermann
Message:

Use a baseclass for document batch processors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/batching.py

    r12260 r12267  
    4141
    4242
    43 class PDFDocumentProcessor(BatchProcessor):
    44     """A batch processor for IPDFDocument objects.
     43class DocumentProcessorBase(BatchProcessor):
     44    """A base for batch processors for IDocument objects.
    4545    """
    4646    grok.implements(IBatchProcessor)
    4747    grok.provides(IBatchProcessor)
    4848    grok.context(Interface)
    49     util_name = 'pdfdocumentprocessor'
    50     grok.name(util_name)
     49    grok.baseclass()
    5150
    52     name = _('Public PDF Document Processor')
    53     iface = IPDFDocument
     51    util_name = None
     52    name = None
     53    iface = None
    5454
    5555    location_fields = ['document_id',]
    56     factory_name = 'waeup.PDFDocument'
     56    factory_name = None
    5757
    5858    additional_fields = ['class_name']
     
    9898        """Update obj to the values given in row.
    9999        """
    100         items_changed = super(PDFDocumentProcessor, self).updateEntry(
     100        items_changed = super(DocumentProcessorBase, self).updateEntry(
    101101            obj, row, site, filename)
    102102        # Log actions...
     
    111111        """
    112112        errs, inv_errs, conv_dict = super(
    113             PDFDocumentProcessor, self).checkConversion(row, mode=mode)
     113            DocumentProcessorBase, self).checkConversion(row, mode=mode)
    114114        # We need to check if the class_name corresponds with the
    115115        # processor chosen. This is to avoid accidentally wrong imports.
     
    121121        return errs, inv_errs, conv_dict
    122122
     123class PDFDocumentProcessor(DocumentProcessorBase):
     124    """A batch processor for IPDFDocument objects.
     125    """
     126    util_name = 'pdfdocumentprocessor'
     127    grok.name(util_name)
     128
     129    name = _('Public PDF Document Processor')
     130    iface = IPDFDocument
     131
     132    factory_name = 'waeup.PDFDocument'
    123133
    124134class HTMLDocumentProcessor(PDFDocumentProcessor):
Note: See TracChangeset for help on using the changeset viewer.