Changeset 12859


Ignore:
Timestamp:
16 Apr 2015, 18:49:08 (10 years ago)
Author:
Henrik Bettermann
Message:

Add more exporter documentation.

Location:
main/waeup.kofa/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/docs/source/userdocs/datacenter.rst

    r12858 r12859  
    2828Regular data exporters (1) collect objects from specific containers, (2) iterate over the collected objects, (3) extract and mangle information from each object, (4) write the information of each object into a row of a CSV file and (5) finally provide the file for download. The CSV file is neither stored in the database nor archived in the filesystem. (3) and (4) means a flattening of the hierarchical data structure, i.e. a mapping of objects to flat relational data to be stored in a CSV table. The extracted information must not necessarily be based only on static attributes of the collected object. The data, finally stored in the CSV file, can also be derived from parent or child objects, or dynamically computed by the object's methods and property attributes. These methods and properties can retrieve information from everywhere in the portal's database.
    2929
    30 In the following we list all exporter classes including the two attributes and a method description. The `fields` attribute contain the column titles of the export file. These are not necessarily only attributes of the exported objects. The `title` attribute unveils the name of the exporter under which this exporter will be displayed in the user interface. The `mangle_value()` method shows how some of fields are being dynamically computed.
     30In the following we list all exporter classes including two attributes and a method description. The `fields` attribute contain the column titles of the export file. These are not necessarily only attributes of the exported objects. The `title` attribute unveils the name of the exporter under which this exporter will be displayed in the user interface. The `mangle_value()` method shows how some of fields are being dynamically computed.
    3131
    32 Academic Section Exporters
    33 --------------------------
     32Regular Exporters
     33-----------------
     34
     35.. autoclass:: waeup.kofa.userscontainer.UserExporter()
     36  :noindex:
     37
     38  .. autoattribute:: waeup.kofa.userscontainer.UserExporter.fields
     39  .. autoattribute:: waeup.kofa.userscontainer.UserExporter.title
     40  .. automethod:: waeup.kofa.userscontainer.UserExporter.mangle_value()
    3441
    3542.. autoclass:: waeup.kofa.university.export.FacultyExporter()
     
    7077
    7178
    72 Application Section Exporters
    73 -----------------------------
     79.. autoclass:: waeup.kofa.applicants.export.ApplicantsContainerExporter()
     80  :noindex:
     81
     82  .. autoattribute:: waeup.kofa.applicants.export.ApplicantsContainerExporter.fields
     83  .. autoattribute:: waeup.kofa.applicants.export.ApplicantsContainerExporter.title
     84
     85.. autoclass:: waeup.kofa.applicants.export.ApplicantExporter()
     86  :noindex:
     87
     88  .. autoattribute:: waeup.kofa.applicants.export.ApplicantExporter.fields
     89  .. autoattribute:: waeup.kofa.applicants.export.ApplicantExporter.title
     90  .. automethod:: waeup.kofa.applicants.export.ApplicantExporter.mangle_value()
     91
     92.. autoclass:: waeup.kofa.accesscodes.export.AccessCodeBatchExporter()
     93  :noindex:
     94
     95  .. autoattribute:: waeup.kofa.accesscodes.export.AccessCodeBatchExporter.fields
     96  .. autoattribute:: waeup.kofa.accesscodes.export.AccessCodeBatchExporter.title
     97
     98.. autoclass:: waeup.kofa.accesscodes.export.AccessCodeExporter()
     99  :noindex:
     100
     101  .. autoattribute:: waeup.kofa.accesscodes.export.AccessCodeExporter.fields
     102  .. autoattribute:: waeup.kofa.accesscodes.export.AccessCodeExporter.title
     103  .. automethod:: waeup.kofa.accesscodes.export.AccessCodeExporter.mangle_value()
     104
     105.. autoclass:: waeup.kofa.hostels.export.HostelExporter()
     106  :noindex:
     107
     108  .. autoattribute:: waeup.kofa.hostels.export.HostelExporter.fields
     109  .. autoattribute:: waeup.kofa.hostels.export.HostelExporter.title
     110
     111.. autoclass:: waeup.kofa.hostels.export.BedExporter()
     112  :noindex:
     113
     114  .. autoattribute:: waeup.kofa.hostels.export.BedExporter.fields
     115  .. autoattribute:: waeup.kofa.hostels.export.BedExporter.title
    74116
    75117
    76 Student Section Exporters
    77 -------------------------
     118Student Data Exporters
     119----------------------
    78120
    79121
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/export.py

    r12180 r12859  
    2727
    2828class AccessCodeBatchExporter(grok.GlobalUtility, ExporterBase):
    29     """Exporter for accesscodebatches.
     29    """The Access Code Batch Exporter exports container data. It does not
     30    export access codes inside the container.
    3031    """
    3132    grok.implements(ICSVExporter)
    3233    grok.name('accesscodebatches')
    3334
    34     #: Fieldnames considered by this exporter
    3535    fields = tuple(sorted(iface_names(IAccessCodeBatch))) + ('batch_id',)
    36 
    37     #: The title under which this exporter will be displayed
    3836    title = _(u'Access Code Batches')
    3937
     
    4846    def export_all(self, site, filepath=None):
    4947        """Export accesscode batches into filepath as CSV data.
    50 
    5148        If `filepath` is ``None``, a raw string with CSV data is returned.
    5249        """
     
    5754        return self.close_outfile(filepath, outfile)
    5855
     56
    5957class AccessCodeExporter(grok.GlobalUtility, ExporterBase):
    60     """Exporter for courses.
     58    """The Access Code Exporter exports all access codes stored in the
     59    access code batch containers. The exporter iterates over all access code
     60    batches and over all access codes inside each batch container.
    6161    """
    6262    grok.implements(ICSVExporter)
    6363    grok.name('accesscodes')
    6464
    65     #: Fieldnames considered by this exporter
    6665    fields = tuple(sorted(iface_names(IAccessCode)))
    67 
    68     #: The title under which this exporter will be displayed
    6966    title = _(u'Access Codes')
    7067
    7168    def mangle_value(self, value, name, context=None):
     69        """The mangler adds a hash symbol at the end of ``random_num``
     70        to avoid annoying automatic number transformation by Excel or Calc.
     71        """
    7272        if name == 'random_num' and value is not None:
    7373            # Append hash '#' to numbers to circumvent
     
    8080    def export_all(self, site, filepath=None):
    8181        """Export accesscodes into filepath as CSV data.
    82 
    8382        If `filepath` is ``None``, a raw string with CSV data is returned.
    8483        """
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py

    r12180 r12859  
    2929
    3030class ApplicantsContainerExporter(grok.GlobalUtility, ExporterBase):
    31     """Exporter for ApplicantsContainers.
     31    """The Applicants Container Exporter exports container data. It does not
     32    export applicants (application records) inside the container.
    3233    """
    3334    grok.implements(ICSVExporter)
    3435    grok.name('applicantscontainers')
    3536
    36     #: Fieldnames considered by this exporter
    3737    fields = tuple(sorted(iface_names(IApplicantsContainer)))
    38     #: The title under which this exporter will be displayed
    3938    title = _(u'Applicants Containers')
    4039
     
    6362        return self.export(containers.values(), filepath)
    6463
     64
    6565class ApplicantExporter(grok.GlobalUtility, ExporterBase):
    66     """Exporter for Applicants.
     66    """The Applicant Exporter exports all application records (= applicants)
     67    stored in the database. In contrast to the exporters in the academics
     68    section this exporter does not iterate over the items of containers
     69    but searches the Applicants Catalog instead.
    6770    """
    6871    grok.implements(ICSVExporter)
    6972    grok.name('applicants')
    7073
    71     #: Fieldnames considered by this exporter
    7274    fields = tuple(sorted(IApplicantBaseData.names())) + ('container_code',)
    73 
    74     #: The title under which this exporter will be displayed
    7575    title = _(u'Applicants')
    7676
    7777    def mangle_value(self, value, name, context=None):
     78        """The mangler determines the the codes of the atributes `course1`,
     79        `course2` and `course_admitted`. It furthermore prepares the
     80        history messages and adds a hash symbol at the end of the phone number
     81        to avoid annoying automatic number transformation by Excel or Calc.
     82        """
    7883        if name in (
    7984            'course1', 'course2', 'course_admitted') and value is not None:
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/export.py

    r9307 r12859  
    2626
    2727class HostelExporter(grok.GlobalUtility, ExporterBase):
    28     """Exporter for hostels.
     28    """The Hostel Exporter exports container data. It does not
     29    export beds inside the container.
    2930    """
    3031    grok.implements(ICSVExporter)
    3132    grok.name('hostels')
    3233
    33     #: Fieldnames considered by this exporter
    3434    fields = tuple(sorted(iface_names(IHostel)))
    35 
    36     #: The title under which this exporter will be displayed
    3735    title = _(u'Hostels')
    3836
    3937    def export_all(self, site, filepath=None):
    4038        """Export hostels into filepath as CSV data.
    41 
    4239        If `filepath` is ``None``, a raw string with CSV data is returned.
    4340        """
     
    4845        return self.close_outfile(filepath, outfile)
    4946
     47
    5048class BedExporter(grok.GlobalUtility, ExporterBase):
    51     """Exporter for courses.
     49    """The Bed Exporter exports all beds stored in the
     50    hostel containers. The exporter iterates over all hostels
     51    and over all beds inside each hostel container.
    5252    """
    5353    grok.implements(ICSVExporter)
    5454    grok.name('beds')
    5555
    56     #: Fieldnames considered by this exporter
    5756    fields = tuple(sorted(iface_names(IBed))) + (
    5857        'hall', 'block', 'room', 'bed', 'special_handling', 'sex', 'bt')
    59 
    60     #: The title under which this exporter will be displayed
    6158    title = _(u'Beds')
    6259
    6360    def export_all(self, site, filepath=None):
    6461        """Export beds into filepath as CSV data.
    65 
    6662        If `filepath` is ``None``, a raw string with CSV data is returned.
    6763        """
  • main/waeup.kofa/trunk/src/waeup/kofa/userscontainer.py

    r12219 r12859  
    6262
    6363class UserExporter(grok.GlobalUtility, ExporterBase):
    64     """Exporter for user accounts.
     64    """The User Exporter exports all user accounts. It iterates over all
     65    objects of the ``users`` container.
    6566    """
    6667    grok.implements(ICSVExporter)
    6768    grok.name('users')
    6869
    69     #: Fieldnames considered by this exporter
    7070    fields = ('name', 'title', 'public_name', 'description',
    7171              'email', 'phone', 'roles', 'local_roles', 'password')
    72 
    73     #: The title under which this exporter will be displayed
    7472    title = _(u'Users')
    7573
    7674    def mangle_value(self, value, name, context=None):
    77         """Treat location values special.
     75        """The mangler determines the local roles each user has and computes
     76        a Python expression like:
     77
     78        ``{u'waeup.local.ClearanceOfficer': [u'faculties/ABC/', u'faculties/DEF/']}``
    7879        """
    79 
    8080        if name == 'local_roles' and context is not None:
    8181            local_roles = context.getLocalRoles()
Note: See TracChangeset for help on using the changeset viewer.