Ignore:
Timestamp:
21 Sep 2012, 08:19:35 (12 years ago)
Author:
uli
Message:

Rollback r9209. Looks like multiple merges from trunk confuse svn when merging back into trunk.

Location:
main/waeup.kofa/branches/uli-zc-async
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-zc-async

  • main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/university/export.py

    r9209 r9211  
    1919"""
    2020import grok
    21 from zope.securitypolicy.interfaces import IPrincipalRoleMap
    2221from waeup.kofa.interfaces import ICSVExporter
    2322from waeup.kofa.interfaces import MessageFactory as _
     
    3130
    3231    #: Fieldnames considered by this exporter
    33     fields = ('code', 'title', 'title_prefix', 'users_with_local_roles')
     32    fields = ('code', 'title', 'title_prefix')
    3433
    3534    #: The title under which this exporter will be displayed
    3635    title = _(u'Faculties')
    37 
    38     def mangle_value(self, value, name, context=None):
    39         """Hook for mangling values in derived classes
    40         """
    41         if name == 'users_with_local_roles':
    42             value = []
    43             role_map = IPrincipalRoleMap(context)
    44             for local_role, user_name, setting in role_map.getPrincipalsAndRoles():
    45                 value.append({'user_name':user_name,'local_role':local_role})
    46         return super(FacultyExporter, self).mangle_value(
    47             value, name, context)
    4836
    4937    def export(self, faculties, filepath=None):
     
    6250        If `filepath` is ``None``, a raw string with CSV data is returned.
    6351        """
     52        writer, outfile = self.get_csv_writer(filepath)
    6453        faculties = site.get('faculties', {})
    6554        return self.export(faculties.values(), filepath)
     
    7261
    7362    #: Fieldnames considered by this exporter
    74     fields = ('code', 'faculty_code', 'title', 'title_prefix',
    75         'users_with_local_roles')
     63    fields = ('code', 'faculty_code', 'title', 'title_prefix')
    7664
    7765    #: The title under which this exporter will be displayed
     
    8977
    9078    def export_all(self, site, filepath=None):
    91         """Export departments in faculty into filepath as CSV data.
     79        """Export faculties in facultycontainer into filepath as CSV data.
    9280
    9381        If `filepath` is ``None``, a raw string with CSV data is returned.
     
    10997    #: Fieldnames considered by this exporter
    11098    fields = ('code', 'faculty_code', 'department_code', 'title', 'credits',
    111               'passmark', 'semester', 'users_with_local_roles')
     99              'passmark', 'semester')
    112100
    113101    #: The title under which this exporter will be displayed
     
    117105        """Hook for mangling values in derived classes
    118106        """
    119         if name == 'users_with_local_roles':
    120             value = []
    121             role_map = IPrincipalRoleMap(context)
    122             for local_role, user_name, setting in role_map.getPrincipalsAndRoles():
    123                 value.append({'user_name':user_name,'local_role':local_role})
    124         elif name == 'faculty_code':
     107        if name == 'faculty_code':
    125108            try:
    126109                value = context.__parent__.__parent__.__parent__.code
     
    136119
    137120    def export_all(self, site, filepath=None):
    138         """Export courses into filepath as CSV data.
     121        """Export faculties in facultycontainer into filepath as CSV data.
    139122
    140123        If `filepath` is ``None``, a raw string with CSV data is returned.
     
    157140    fields = ('code', 'faculty_code', 'department_code', 'title', 'study_mode',
    158141              'start_level', 'end_level', 'application_category',
    159               'school_fee_1', 'school_fee_2', 'school_fee_3', 'school_fee_4',
    160               'users_with_local_roles')
     142              'school_fee_1', 'school_fee_2')
    161143
    162144    #: The title under which this exporter will be displayed
     
    164146
    165147    def export_all(self, site, filepath=None):
    166         """Export certificates into filepath as CSV data.
     148        """Export faculties in facultycontainer into filepath as CSV data.
    167149
    168150        If `filepath` is ``None``, a raw string with CSV data is returned.
     
    211193
    212194    def export_all(self, site, filepath=None):
    213         """Export certificate courses into filepath as CSV data.
     195        """Export faculties in facultycontainer into filepath as CSV data.
    214196
    215197        If `filepath` is ``None``, a raw string with CSV data is returned.
Note: See TracChangeset for help on using the changeset viewer.