- Timestamp:
- 21 Sep 2012, 08:19:35 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
/main/waeup.kofa/branches/uli-async-update removed /main/waeup.kofa/branches/uli-autoinclude-less removed /main/waeup.kofa/trunk removed
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/university/export.py
r9209 r9211 19 19 """ 20 20 import grok 21 from zope.securitypolicy.interfaces import IPrincipalRoleMap22 21 from waeup.kofa.interfaces import ICSVExporter 23 22 from waeup.kofa.interfaces import MessageFactory as _ … … 31 30 32 31 #: Fieldnames considered by this exporter 33 fields = ('code', 'title', 'title_prefix' , 'users_with_local_roles')32 fields = ('code', 'title', 'title_prefix') 34 33 35 34 #: The title under which this exporter will be displayed 36 35 title = _(u'Faculties') 37 38 def mangle_value(self, value, name, context=None):39 """Hook for mangling values in derived classes40 """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)48 36 49 37 def export(self, faculties, filepath=None): … … 62 50 If `filepath` is ``None``, a raw string with CSV data is returned. 63 51 """ 52 writer, outfile = self.get_csv_writer(filepath) 64 53 faculties = site.get('faculties', {}) 65 54 return self.export(faculties.values(), filepath) … … 72 61 73 62 #: 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') 76 64 77 65 #: The title under which this exporter will be displayed … … 89 77 90 78 def export_all(self, site, filepath=None): 91 """Export departments in facultyinto filepath as CSV data.79 """Export faculties in facultycontainer into filepath as CSV data. 92 80 93 81 If `filepath` is ``None``, a raw string with CSV data is returned. … … 109 97 #: Fieldnames considered by this exporter 110 98 fields = ('code', 'faculty_code', 'department_code', 'title', 'credits', 111 'passmark', 'semester' , 'users_with_local_roles')99 'passmark', 'semester') 112 100 113 101 #: The title under which this exporter will be displayed … … 117 105 """Hook for mangling values in derived classes 118 106 """ 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': 125 108 try: 126 109 value = context.__parent__.__parent__.__parent__.code … … 136 119 137 120 def export_all(self, site, filepath=None): 138 """Export coursesinto filepath as CSV data.121 """Export faculties in facultycontainer into filepath as CSV data. 139 122 140 123 If `filepath` is ``None``, a raw string with CSV data is returned. … … 157 140 fields = ('code', 'faculty_code', 'department_code', 'title', 'study_mode', 158 141 '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') 161 143 162 144 #: The title under which this exporter will be displayed … … 164 146 165 147 def export_all(self, site, filepath=None): 166 """Export certificatesinto filepath as CSV data.148 """Export faculties in facultycontainer into filepath as CSV data. 167 149 168 150 If `filepath` is ``None``, a raw string with CSV data is returned. … … 211 193 212 194 def export_all(self, site, filepath=None): 213 """Export certificate coursesinto filepath as CSV data.195 """Export faculties in facultycontainer into filepath as CSV data. 214 196 215 197 If `filepath` is ``None``, a raw string with CSV data is returned.
Note: See TracChangeset for help on using the changeset viewer.