Changeset 12858 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 16 Apr 2015, 12:03:32 (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/browser/captcha.py
r11254 r12858 286 286 287 287 The ``error_code`` can be taken from a previously fetched 288 :class:` `CaptchaResponse`` instance (as returned by289 :meth:` `verify``). If it is not ``None``, it might be288 :class:`CaptchaResponse` instance (as returned by 289 :meth:`verify`). If it is not ``None``, it might be 290 290 displayed inside the generated captcha box (in human readable 291 291 form). -
main/waeup.kofa/trunk/src/waeup/kofa/university/export.py
r12857 r12858 24 24 from waeup.kofa.utils.batching import ExporterBase 25 25 26 26 27 class FacultyExporter(grok.GlobalUtility, ExporterBase): 27 """The Faculty Exporter exports all faculties in the 'faculties'28 """The Faculty Exporter exports all faculties in the 'faculties' 28 29 container. This is the only place where faculties are stored. 29 30 """ … … 36 37 37 38 def mangle_value(self, value, name, context=None): 38 """The users_with_local_roles column contains Python expression like: 39 """The mangler computes the users_with_local_roles value which 40 is a Python expression like: 39 41 40 42 ``[{'user_name': u'bob', 'local_role': u'bobsrole'}, … … 66 68 return self.export(faculties.values(), filepath) 67 69 70 68 71 class DepartmentExporter(FacultyExporter, grok.GlobalUtility): 69 """Exporter for departments. 72 """The Department Exporter exports all departments stored in the faculty 73 containers. The exporter iterates over all faculties and then over all 74 departments inside each faculty container. 70 75 """ 71 76 grok.implements(ICSVExporter) 72 77 grok.name('departments') 73 78 74 #: Fieldnames considered by this exporter75 79 fields = ('code', 'faculty_code', 'title', 'title_prefix', 76 80 'users_with_local_roles') … … 79 83 80 84 def mangle_value(self, value, name, context=None): 81 """Hook for mangling values in derived classes 85 """The mangler additionally computes the faculty_code value 86 which is the code (= object id) of the faculty that hosts 87 the department. 82 88 """ 83 89 if name == 'faculty_code': … … 101 107 102 108 class CourseExporter(FacultyExporter, grok.GlobalUtility): 103 """Exporter for courses. 109 """The Course Exporter exports all courses in the database. It iterates 110 over all departments and faculties. 104 111 """ 105 112 grok.implements(ICSVExporter) 106 113 grok.name('courses') 107 114 108 #: Fieldnames considered by this exporter109 115 fields = ('code', 'faculty_code', 'department_code', 'title', 'credits', 110 116 'passmark', 'semester', 'users_with_local_roles', 'former_course') 111 117 112 #: The title under which this exporter will be displayed113 118 title = _(u'Courses') 114 119 115 120 def mangle_value(self, value, name, context=None): 116 """ 121 """The mangler additionally computes the department_code value 122 which is the code of the department that offers the course. 117 123 """ 118 124 if name == 'users_with_local_roles': … … 137 143 def export_all(self, site, filepath=None): 138 144 """Export courses into filepath as CSV data. 139 140 145 If `filepath` is ``None``, a raw string with CSV data is returned. 141 146 """ … … 148 153 return self.close_outfile(filepath, outfile) 149 154 155 150 156 class CertificateExporter(CourseExporter, grok.GlobalUtility): 151 """Exporter for courses. 157 """The Certificate Exporter exports all certificates in the database. 158 It iterates over all departments and faculties. 152 159 """ 153 160 grok.implements(ICSVExporter) 154 161 grok.name('certificates') 155 162 156 #: Fieldnames considered by this exporter157 163 fields = ('code', 'faculty_code', 'department_code', 'title', 'study_mode', 158 164 'start_level', 'end_level', 'application_category', 'ratio', … … 162 168 'users_with_local_roles') 163 169 164 #: The title under which this exporter will be displayed165 170 title = _(u'Certificates') 166 171 172 def mangle_value(self, value, name, context=None): 173 """The mangler additionally computes the department_code value 174 which is the code of the department that offers the certificate. 175 """ 176 return super(CertificateExporter, self).mangle_value( 177 value, name, context) 178 167 179 def export_all(self, site, filepath=None): 168 180 """Export certificates into filepath as CSV data. 169 170 181 If `filepath` is ``None``, a raw string with CSV data is returned. 171 182 """ … … 178 189 return self.close_outfile(filepath, outfile) 179 190 191 180 192 class CertificateCourseExporter(CourseExporter, grok.GlobalUtility): 181 """Exporter for courses. 193 """The Certificate Course Exporter exports all certificate courses 194 (:class:`CertificateCourse 195 <waeup.kofa.university.certificate.CertificateCourse>` instances) in 196 the database. It iterates over all departments and faculties. 182 197 """ 183 198 grok.implements(ICSVExporter) 184 199 grok.name('certificate_courses') 185 200 186 #: Fieldnames considered by this exporter187 201 fields = ('course', 'faculty_code', 'department_code', 'certificate_code', 188 202 'level', 'mandatory') 189 203 190 #: The title under which this exporter will be displayed191 204 title = _(u'Courses in Certificates') 192 205 193 206 def mangle_value(self, value, name, context=None): 194 """Hook for mangling values in derived classes 207 """The mangler computes the codes of the faculty, the department and 208 the certificate which require the course. It also exports the 209 course code. 210 211 .. note:: The course must not necessarily be offered by the same 212 department. 195 213 """ 196 214 if name == 'faculty_code': … … 214 232 def export_all(self, site, filepath=None): 215 233 """Export certificate courses into filepath as CSV data. 216 217 234 If `filepath` is ``None``, a raw string with CSV data is returned. 218 235 """
Note: See TracChangeset for help on using the changeset viewer.