Changeset 7726


Ignore:
Timestamp:
29 Feb 2012, 13:41:49 (13 years ago)
Author:
uli
Message:

(Re-)add an interface for CSV exporters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py

    r7703 r7726  
    199199    """
    200200
     201class ICSVExporter(Interface):
     202    """A CSV file exporter for objects.
     203    """
     204    fields = Attribute("""List of fieldnames in resulting CSV""")
     205   
     206    def mangle_value(value, name, obj):
     207        """Mangle `value` extracted from `obj` or suobjects thereof.
     208
     209        This is called by export before actually writing to the result file.
     210        """
     211
     212    def export(context, filepath=None):
     213        """Export context as CSV file.
     214
     215        If `filepath` is not given, a string with the data should be returned.
     216        """
     217
     218    def export_all(site, filapath=None):
     219        """Export all items in `site` as CSV file.
     220
     221        if `filepath` is not given, a string with the data should be returned.
     222        """
     223
    201224class ISIRPExporter(Interface):
    202225    """An exporter for objects.
Note: See TracChangeset for help on using the changeset viewer.