Changeset 4172


Ignore:
Timestamp:
25 May 2009, 17:34:57 (16 years ago)
Author:
uli
Message:

Update tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/datacenter.txt

    r4169 r4172  
    6464Data centers can find objects ready for CSV imports and associate
    6565appropriate importers with them.
     66
     67Getting importers
     68-----------------
    6669
    6770To do so, data centers look up their parents for the nearest ancestor,
     
    145148In the WAeUP portal the only component that actually provides CSV data
    146149importables is the `University` object.
     150
     151
     152Getting imports (not: importers)
     153--------------------------------
     154
     155We 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
     167As we can see, an import is defined here as a tuple of a
     168DataCenterFile and a list of available importers.
     169
     170Clean up:
     171
     172    >>> os.unlink(filepath)
Note: See TracChangeset for help on using the changeset viewer.