Changeset 4172
- Timestamp:
- 25 May 2009, 17:34:57 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/datacenter.txt
r4169 r4172 64 64 Data centers can find objects ready for CSV imports and associate 65 65 appropriate importers with them. 66 67 Getting importers 68 ----------------- 66 69 67 70 To do so, data centers look up their parents for the nearest ancestor, … … 145 148 In the WAeUP portal the only component that actually provides CSV data 146 149 importables is the `University` object. 150 151 152 Getting imports (not: importers) 153 -------------------------------- 154 155 We can get 'imports'. For this, we need a CSV file to import: 156 157 >>> import os 158 >>> filepath = os.path.join(datacenter.storage, 'mydata.csv') 159 >>> open(filepath, 'wb').write("""col1,col2 160 ... 'ATerm','Something' 161 ... """) 162 163 >>> datacenter.getPossibleImports() 164 [(<...DataCenterFile object at 0x...>, 165 [<MyCSVImporter object at 0x...>, <MyCSVImporter object at 0x...>])] 166 167 As we can see, an import is defined here as a tuple of a 168 DataCenterFile and a list of available importers. 169 170 Clean up: 171 172 >>> os.unlink(filepath)
Note: See TracChangeset for help on using the changeset viewer.