Ignore:
Timestamp:
15 Apr 2015, 14:28:46 (9 years ago)
Author:
Henrik Bettermann
Message:

Documentation work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/university/export.py

    r10185 r12857  
    2525
    2626class FacultyExporter(grok.GlobalUtility, ExporterBase):
    27     """Exporter for faculties.
     27    """The FacultyExporter exports all faculties in the 'faculties'
     28    container. This is the only place where faculties are stored.
    2829    """
    2930    grok.implements(ICSVExporter)
    3031    grok.name('faculties')
    3132
    32     #: Fieldnames considered by this exporter
    3333    fields = ('code', 'title', 'title_prefix', 'users_with_local_roles')
    3434
    35     #: The title under which this exporter will be displayed
    3635    title = _(u'Faculties')
    3736
    3837    def mangle_value(self, value, name, context=None):
    39         """Hook for mangling values in derived classes
     38        """The users_with_local_roles column contains Python expression like:
     39
     40        ``[{'user_name': u'bob', 'local_role': u'bobsrole'},
     41        {'user_name': u'anna', 'local_role': u'annasrole'}]``
    4042        """
    4143        if name == 'users_with_local_roles':
    4244            value = []
    4345            role_map = IPrincipalRoleMap(context)
    44             for local_role, user_name, setting in role_map.getPrincipalsAndRoles():
     46            for local_role, user_name, setting in \
     47                role_map.getPrincipalsAndRoles():
    4548                value.append({'user_name':user_name,'local_role':local_role})
    4649        return super(FacultyExporter, self).mangle_value(
     
    4952    def export(self, faculties, filepath=None):
    5053        """Export `faculties`, an iterable, as CSV file.
    51 
    5254        If `filepath` is ``None``, a raw string with CSV data is returned.
    5355        """
     
    5961    def export_all(self, site, filepath=None):
    6062        """Export faculties in facultycontainer into filepath as CSV data.
    61 
    6263        If `filepath` is ``None``, a raw string with CSV data is returned.
    6364        """
     
    7576        'users_with_local_roles')
    7677
    77     #: The title under which this exporter will be displayed
    7878    title = _(u'Departments')
    7979
     
    9090    def export_all(self, site, filepath=None):
    9191        """Export departments in faculty into filepath as CSV data.
    92 
    9392        If `filepath` is ``None``, a raw string with CSV data is returned.
    9493        """
     
    115114
    116115    def mangle_value(self, value, name, context=None):
    117         """Hook for mangling values in derived classes
     116        """
    118117        """
    119118        if name == 'users_with_local_roles':
    120119            value = []
    121120            role_map = IPrincipalRoleMap(context)
    122             for local_role, user_name, setting in role_map.getPrincipalsAndRoles():
     121            for local_role, user_name, setting in \
     122                role_map.getPrincipalsAndRoles():
    123123                value.append({'user_name':user_name,'local_role':local_role})
    124124        elif name == 'faculty_code':
Note: See TracChangeset for help on using the changeset viewer.