Changeset 4283
- Timestamp:
- 13 Jun 2009, 18:29:47 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/csvfile/README.txt
r4219 r4283 1 waeup.csvfile 2 ************* 3 4 Generic support for handling CSV files. 1 :mod:`waeup.csvfile` -- generic support for handling CSV files 2 ************************************************************** 5 3 6 4 :Test-Layer: unit 5 6 .. module:: waeup.csvfile 7 :synopsis: generic support for handling CSV files. 8 9 .. Module Contents 10 .. ================ 11 12 .. class:: CSVFile(filepath) 13 14 Wrapper around the path to a real CSV file. :class:`CSVFile` is an 15 adapter that adapts basestring objects (aka regular and unicode 16 strings). 17 18 .. method:: grok.context(basestring) 19 :noindex: 20 21 We bind to basestring objects. 22 23 .. method:: grok.implements(ICSVFile) 24 :noindex: 25 26 .. attribute:: required_fields=[] 27 28 A list of header fields (strings) required for this kind of 29 CSVFile. Using the default constructor will fail with paths to 30 files that do *not* provide those fields. 31 32 The defaul value (empty list) means: no special fields required 33 at all. 34 35 Deriving classes can override this attribute to accept only 36 files that provide the appropriate header fields. The default 37 constructor already checks this. 38 39 .. attribute:: path 40 41 A string describing the path to the associated CSV file. 42 43 .. method:: getData() 44 45 Returns a generator delivering one data row of the denoted file 46 at a time. 47 48 Each data row is delivered as a dictionary mapping from header 49 field names to the values. Therefore a source line like this:: 50 51 field1,field2 52 ... 53 data 1,data 2 54 55 will become a dictionary like this:: 56 57 {'field1' : 'data 1', 58 'field2' : 'data 2'} 59 60 The :meth:`getData` method does not evaluate file 61 values for correct data types or so. 62 7 63 8 64
Note: See TracChangeset for help on using the changeset viewer.