Changeset 12857 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 15 Apr 2015, 14:28:46 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/university/export.py
r10185 r12857 25 25 26 26 class 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. 28 29 """ 29 30 grok.implements(ICSVExporter) 30 31 grok.name('faculties') 31 32 32 #: Fieldnames considered by this exporter33 33 fields = ('code', 'title', 'title_prefix', 'users_with_local_roles') 34 34 35 #: The title under which this exporter will be displayed36 35 title = _(u'Faculties') 37 36 38 37 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'}]`` 40 42 """ 41 43 if name == 'users_with_local_roles': 42 44 value = [] 43 45 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(): 45 48 value.append({'user_name':user_name,'local_role':local_role}) 46 49 return super(FacultyExporter, self).mangle_value( … … 49 52 def export(self, faculties, filepath=None): 50 53 """Export `faculties`, an iterable, as CSV file. 51 52 54 If `filepath` is ``None``, a raw string with CSV data is returned. 53 55 """ … … 59 61 def export_all(self, site, filepath=None): 60 62 """Export faculties in facultycontainer into filepath as CSV data. 61 62 63 If `filepath` is ``None``, a raw string with CSV data is returned. 63 64 """ … … 75 76 'users_with_local_roles') 76 77 77 #: The title under which this exporter will be displayed78 78 title = _(u'Departments') 79 79 … … 90 90 def export_all(self, site, filepath=None): 91 91 """Export departments in faculty into filepath as CSV data. 92 93 92 If `filepath` is ``None``, a raw string with CSV data is returned. 94 93 """ … … 115 114 116 115 def mangle_value(self, value, name, context=None): 117 """ Hook for mangling values in derived classes116 """ 118 117 """ 119 118 if name == 'users_with_local_roles': 120 119 value = [] 121 120 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(): 123 123 value.append({'user_name':user_name,'local_role':local_role}) 124 124 elif name == 'faculty_code': -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
r12811 r12857 437 437 438 438 def mangle_value(self, value, name, context=None): 439 """Hook for mangling values in derived classes 439 """Hook for mangling values in derived classes. 440 440 """ 441 441 if isinstance(value, bool):
Note: See TracChangeset for help on using the changeset viewer.