Changeset 9802 for main/waeup.kofa/trunk/src
- Timestamp:
- 15 Dec 2012, 11:16:25 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r9801 r9802 34 34 'coursetickets', 'studentpayments') 35 35 36 def ident(x):37 return x38 #for item in x:39 # yield item40 41 36 def get_students(site, stud_filter=StudentsQuery()): 42 37 """Get all students registered in catalog in `site`. … … 96 91 97 92 def filter_func(self, x): 98 return get_students(x)93 return x 99 94 100 95 def get_filtered(self, site, **kw): … … 131 126 If `filepath` is ``None``, a raw string with CSV data is returned. 132 127 """ 133 return self.export(self.filter_func( site), filepath)128 return self.export(self.filter_func(get_students(site)), filepath) 134 129 135 130 def export_student(self, student, filepath=None): 136 131 return self.export(self.filter_func([student]), filepath=filepath) 132 133 def export_filtered(self, site, filepath=None, **kw): 134 """Export items denoted by `kw`. 135 136 If `filepath` is ``None``, a raw string with CSV data should 137 be returned. 138 """ 139 data = self.get_filtered(site, **kw) 140 return self.export(self.filter_func(data), filepath=filepath) 137 141 138 142 … … 162 166 value, name, context=context) 163 167 164 def export_all(self, site, filepath=None):165 """Export students into filepath as CSV data.166 167 If `filepath` is ``None``, a raw string with CSV data is returned.168 """169 return self.export(get_students(site), filepath)170 171 def export_student(self, student, filepath=None):172 return self.export([student], filepath=filepath)173 168 174 169 class StudentStudyCourseExporter(grok.GlobalUtility, StudentExporterBase): … … 199 194 value, name, context=context) 200 195 201 def export_all(self, site, filepath=None):202 """Export study courses into filepath as CSV data.203 204 If `filepath` is ``None``, a raw string with CSV data is returned.205 """206 return self.export(get_studycourses(get_students(site)), filepath)207 208 def export_student(self, student, filepath=None):209 """Export studycourse of a single student object.210 """211 return self.export(get_studycourses([student]), filepath)212 213 def export_filtered(self, site, filepath=None, **kw):214 """Export items denoted by `args` and `kw`.215 216 If `filepath` is ``None``, a raw string with CSV data should217 be returned.218 """219 data = self.get_filtered(site, **kw)220 return self.export(get_studycourses(data), filepath=filepath)221 222 196 223 197 class StudentStudyLevelExporter(grok.GlobalUtility, StudentExporterBase): … … 234 208 title = _(u'Student Study Levels') 235 209 210 def filter_func(self, x): 211 return get_levels(x) 212 236 213 def mangle_value(self, value, name, context=None): 237 214 """Treat location values special. … … 243 220 StudentStudyLevelExporter, self).mangle_value( 244 221 value, name, context=context) 245 246 def export_all(self, site, filepath=None):247 """Export study levels into filepath as CSV data.248 249 If `filepath` is ``None``, a raw string with CSV data is returned.250 """251 return self.export(get_levels(get_students(site)), filepath)252 253 def export_student(self, student, filepath=None):254 return self.export(get_levels([student]), filepath)255 256 def export_filtered(self, site, filepath=None, **kw):257 """Export items denoted by `args` and `kw`.258 259 If `filepath` is ``None``, a raw string with CSV data should260 be returned.261 """262 data = self.get_filtered(site, **kw)263 return self.export(get_levels(data), filepath=filepath)264 222 265 223 class CourseTicketExporter(grok.GlobalUtility, StudentExporterBase): … … 274 232 #: The title under which this exporter will be displayed 275 233 title = _(u'Course Tickets') 234 235 def filter_func(self, x): 236 return get_tickets(x) 276 237 277 238 def mangle_value(self, value, name, context=None): … … 288 249 value, name, context=context) 289 250 290 def export_all(self, site, filepath=None):291 """Export course tickets into filepath as CSV data.292 293 If `filepath` is ``None``, a raw string with CSV data is returned.294 """295 return self.export(get_tickets(get_students(site)), filepath)296 297 def export_student(self, student, filepath=None):298 return self.export(get_tickets([student]), filepath)299 300 def export_filtered(self, site, filepath=None, **kw):301 """Export items denoted by `args` and `kw`.302 303 If `filepath` is ``None``, a raw string with CSV data should304 be returned.305 """306 data = self.get_filtered(site, **kw)307 return self.export(get_tickets(data), filepath=filepath)308 309 251 310 252 class PaymentsExporter(grok.GlobalUtility, StudentExporterBase): … … 322 264 title = _(u'Student Payments') 323 265 266 def filter_func(self, x): 267 return get_payments(x) 268 324 269 def mangle_value(self, value, name, context=None): 325 270 """Treat location values special. … … 332 277 PaymentsExporter, self).mangle_value( 333 278 value, name, context=context) 334 335 def export_all(self, site, filepath=None):336 """Export payments into filepath as CSV data.337 338 If `filepath` is ``None``, a raw string with CSV data is returned.339 """340 return self.export(get_payments(get_students(site)), filepath)341 342 def export_student(self, student, filepath=None):343 return self.export(get_payments([student]), filepath)344 345 def export_filtered(self, site, filepath=None, **kw):346 """Export items denoted by `args` and `kw`.347 348 If `filepath` is ``None``, a raw string with CSV data should349 be returned.350 """351 data = self.get_filtered(site, **kw)352 return self.export(get_payments(data), filepath=filepath)353 279 354 280 class BedTicketsExporter(grok.GlobalUtility, StudentExporterBase): … … 365 291 #: The title under which this exporter will be displayed 366 292 title = _(u'Bed Tickets') 293 294 def filter_func(self, x): 295 return get_bedtickets(x) 367 296 368 297 def mangle_value(self, value, name, context=None): … … 380 309 BedTicketsExporter, self).mangle_value( 381 310 value, name, context=context) 382 383 def export_all(self, site, filepath=None):384 """Export payments into filepath as CSV data.385 386 If `filepath` is ``None``, a raw string with CSV data is returned.387 """388 return self.export(get_bedtickets(get_students(site)), filepath)389 390 def export_student(self, student, filepath=None):391 return self.export(get_bedtickets([student]), filepath)392 393 def export_filtered(self, site, filepath=None, **kw):394 """Export items denoted by `args` and `kw`.395 396 If `filepath` is ``None``, a raw string with CSV data should397 be returned.398 """399 data = self.get_filtered(site, **kw)400 return self.export(get_bedtickets(data), filepath=filepath)401 311 402 312 class StudentPaymentsOverviewExporter(StudentsExporter):
Note: See TracChangeset for help on using the changeset viewer.