- Timestamp:
- 25 Dec 2009, 03:41:17 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/datacenter.txt
r4225 r4569 174 174 automatically. 175 175 176 The datacenter is now able to find the CSV receivers in its parents: 177 178 >>> datacenter.getImporters() 179 [<MyCSVImporter object at 0x...>, <MyCSVImporter object at 0x...>] 180 181 182 Imports with the WAeUP portal 183 ----------------------------- 184 185 The examples above looks complicated, but this is the price for 186 modularity. If you create a new container type, you can define an 187 importer and it will be used automatically by other components. 188 189 In the WAeUP portal the only component that actually provides CSV data 190 importables is the `University` object. 191 192 193 Getting imports (not: importers) 194 -------------------------------- 195 196 We can get 'imports'. For this, we need a CSV file to import: 176 Before we can go on, we have to set a usable path where we can store 177 files without doing harm: 178 179 >>> os.mkdir('filestore') 180 >>> filestore = os.path.abspath('filestore') 181 >>> datacenter.setStoragePath(filestore) 182 [] 183 184 Furthermore we must create a file for possible import, as we will get 185 only importers, for which also an importable file is available: 197 186 198 187 >>> import os … … 202 191 ... """) 203 192 193 The datacenter is now able to find the CSV receivers in its parents: 194 195 >>> datacenter.getImporters() 196 [<MyCSVImporter object at 0x...>, <MyCSVImporter object at 0x...>] 197 198 199 Imports with the WAeUP portal 200 ----------------------------- 201 202 The examples above looks complicated, but this is the price for 203 modularity. If you create a new container type, you can define an 204 importer and it will be used automatically by other components. 205 206 In the WAeUP portal the only component that actually provides CSV data 207 importables is the `University` object. 208 209 210 Getting imports (not: importers) 211 -------------------------------- 212 213 We can get 'imports': 214 204 215 >>> datacenter.getPossibleImports() 205 216 [(<...DataCenterFile object at 0x...>, … … 216 227 Clean up: 217 228 218 >>> os.unlink(filepath) 229 >>> import shutil 230 >>> shutil.rmtree(filestore) 219 231 220 232
Note: See TracChangeset for help on using the changeset viewer.