Changeset 4574


Ignore:
Timestamp:
26 Dec 2009, 12:59:04 (15 years ago)
Author:
uli
Message:

Apply last fixes to ulif-rewrite to this branch as well.

Location:
waeup/branches/ulif-layout/src/waeup
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/browser.txt

    r4515 r4574  
    572572  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    573573  ...The following files are available for import:...
     574  ...mycertcourses.csv...Certificate Course Importer...
     575  ...mycertificates.csv...Certificate Importer...
     576  ...mycourses.csv...Course Importer...
     577  ...mydepartments.csv...Department Importer...
    574578  ...myfaculties.csv...Faculty Importer...
    575   ...mydepartments.csv...Department Importer...
    576   ...mycourses.csv...Course Importer...
    577   ...mycertificates.csv...Certificate Importer...
    578   ...mycertcourses.csv...Certificate Course Importer...
    579579  ...
    580580
     
    585585appropriate file:
    586586
    587   >>> facimport = browser.getControl('Import!', index=0)
     587  >>> facimport = browser.getControl('Import!', index=4)
    588588  >>> facimport.click()
    589589
     
    607607  >>> browser.open('http://localhost/myuniversity/datacenter')
    608608  >>> browser.getLink('Import CSV data').click()
    609   >>> browser.getControl('Import!', index=1).click()
     609  >>> browser.getControl('Import!', index=3).click()
    610610
    611611  >>> print browser.contents
     
    629629  >>> browser.open('http://localhost/myuniversity/datacenter')
    630630  >>> browser.getLink('Import CSV data').click()
    631   >>> browser.getControl('Import!', index=3).click()
     631  >>> browser.getControl('Import!', index=1).click()
    632632
    633633  >>> print browser.contents
     
    640640  >>> browser.open('http://localhost/myuniversity/datacenter')
    641641  >>> browser.getLink('Import CSV data').click()
    642   >>> browser.getControl('Import!', index=4).click()
     642  >>> browser.getControl('Import!', index=0).click()
    643643
    644644  >>> print browser.contents
  • waeup/branches/ulif-layout/src/waeup/datacenter.py

    r4277 r4574  
    1313from zope.interface import Interface
    1414from waeup.csvfile import getCSVFile
    15 from waeup.interfaces import IWAeUPObject, IWAeUPCSVImporter, ICSVDataReceivers
     15from waeup.interfaces import (IWAeUPObject, IWAeUPCSVImporter,
     16                              ICSVDataReceivers, IDataCenterFile)
    1617from waeup.utils.helpers import copyFileSystemTree
    1718from waeup.viewlets import Index, MainArea, LeftSidebar
     
    6768    def getFiles(self):
    6869        """Get a list of files stored in `storage`.
     70
     71        Files are sorted by basename.
    6972        """
    7073        result = []
    7174        if not os.path.exists(self.storage):
    7275            return result
    73         for filename in os.listdir(self.storage):
     76        for filename in sorted(os.listdir(self.storage)):
    7477            fullpath = os.path.join(self.storage, filename)
    7578            if not os.path.isfile(fullpath):
     
    171174        return
    172175
    173        
    174 class IDataCenterFile(Interface):
    175     """A data center file.
    176     """
    177     pass
    178 
    179 
    180176class DataCenterFile(object):
    181177    """A description of a file stored in data center.
  • waeup/branches/ulif-layout/src/waeup/datacenter.txt

    r4225 r4574  
    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
  • waeup/branches/ulif-layout/src/waeup/interfaces.py

    r4559 r4574  
    393393    data, i.e. for which an IWAeUPCSVDataImporter exists.
    394394    """
     395
     396class IDataCenterFile(Interface):
     397    """A data center file.
     398    """
     399    def getDate():
     400        """Get creation timestamp from file in human readable form.
     401        """
     402
     403    def getSize():
     404        """Get human readable size of file.
     405        """
Note: See TracChangeset for help on using the changeset viewer.