Changeset 12516 for main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
- Timestamp:
- 27 Jan 2015, 08:31:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
r12513 r12516 497 497 raise NotImplementedError 498 498 499 def get_selected(self, site, selected): 500 """Get datasets to export for selected items 501 specified by a list of identifiers. 502 503 Returns an iterable. 504 """ 505 raise NotImplementedError 506 499 507 def export(self, iterable, filepath=None): 500 508 """Export `iterable` as CSV file. … … 521 529 """ 522 530 data = self.get_filtered(site, **kw) 531 return self.export(data, filepath=filepath) 532 533 def export_selected(self, site, filepath=None, **kw): 534 """Export those items specified by a list of identifiers 535 called `selected`. 536 537 If `filepath` is ``None``, a raw string with CSV data should 538 be returned. 539 """ 540 selected = kw.get('selected', []) 541 data = self.get_selected(site, selected) 523 542 return self.export(data, filepath=filepath) 524 543 … … 551 570 if kw == {}: 552 571 exporter.export_all(site, filepath=output_path) 572 elif kw.has_key('selected'): 573 exporter.export_selected(site, filepath=output_path, **kw) 553 574 else: 554 575 exporter.export_filtered(site, filepath=output_path, **kw)
Note: See TracChangeset for help on using the changeset viewer.