Changeset 4223
- Timestamp:
- 8 Jun 2009, 16:59:22 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.txt
r4162 r4223 88 88 ... """) 89 89 90 We get a suitable importer by asking for an adapter to 91 IWAeUPCSVExporter (see section above for details): 90 We get a suitable importer by asking for a multi-adapter to 91 our file and IWAeUPCSVExporter (see section above, the importexport 92 module and the `waeup.csvfile` README for details): 92 93 94 >>> from waeup.csvfile import getCSVFile 93 95 >>> from waeup.interfaces import IWAeUPCSVImporter 94 >>> importer = IWAeUPCSVImporter(mycontainer) 96 >>> from zope.component import getMultiAdapter 97 >>> importer = getMultiAdapter((getCSVFile('myfaculties.csv'), 98 ... mycontainer), 99 ... IWAeUPCSVImporter) 95 100 >>> importer 96 101 <waeup.university.facultycontainer.FacultyCSVImporter object at 0x...> … … 113 118 Now we can easily import the data: 114 119 115 >>> importer.doImport( 'myfaculties.csv')120 >>> importer.doImport() 116 121 117 122 The container is now filled: … … 124 129 125 130 126 We can validate data of CSV files without actually importing127 them. This can help for instance while checking uploaded files:128 129 >>> importer.validate('myfaculties.csv')130 True131 132 131 Clean up: 133 132
Note: See TracChangeset for help on using the changeset viewer.