Changeset 4569 for waeup/branches


Ignore:
Timestamp:
25 Dec 2009, 03:41:17 (15 years ago)
Author:
uli
Message:

Fix tests: datacenter tests ran on a real-world directory which could
lead to unpredictable results.

File:
1 edited

Legend:

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

    r4225 r4569  
    174174automatically.
    175175
    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:
     176Before we can go on, we have to set a usable path where we can store
     177files without doing harm:
     178
     179    >>> os.mkdir('filestore')
     180    >>> filestore = os.path.abspath('filestore')
     181    >>> datacenter.setStoragePath(filestore)
     182    []
     183
     184Furthermore we must create a file for possible import, as we will get
     185only importers, for which also an importable file is available:
    197186
    198187    >>> import os
     
    202191    ... """)
    203192
     193The 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
     199Imports with the WAeUP portal
     200-----------------------------
     201
     202The examples above looks complicated, but this is the price for
     203modularity. If you create a new container type, you can define an
     204importer and it will be used automatically by other components.
     205
     206In the WAeUP portal the only component that actually provides CSV data
     207importables is the `University` object.
     208
     209
     210Getting imports (not: importers)
     211--------------------------------
     212
     213We can get 'imports':
     214
    204215    >>> datacenter.getPossibleImports()
    205216    [(<...DataCenterFile object at 0x...>,
     
    216227Clean up:
    217228
    218     >>> os.unlink(filepath)
     229    >>> import shutil
     230    >>> shutil.rmtree(filestore)
    219231
    220232
Note: See TracChangeset for help on using the changeset viewer.