Changeset 4574
- Timestamp:
- 26 Dec 2009, 12:59:04 (15 years ago)
- Location:
- waeup/branches/ulif-layout/src/waeup
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser.txt
r4515 r4574 572 572 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 573 573 ...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... 574 578 ...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...579 579 ... 580 580 … … 585 585 appropriate file: 586 586 587 >>> facimport = browser.getControl('Import!', index= 0)587 >>> facimport = browser.getControl('Import!', index=4) 588 588 >>> facimport.click() 589 589 … … 607 607 >>> browser.open('http://localhost/myuniversity/datacenter') 608 608 >>> browser.getLink('Import CSV data').click() 609 >>> browser.getControl('Import!', index= 1).click()609 >>> browser.getControl('Import!', index=3).click() 610 610 611 611 >>> print browser.contents … … 629 629 >>> browser.open('http://localhost/myuniversity/datacenter') 630 630 >>> browser.getLink('Import CSV data').click() 631 >>> browser.getControl('Import!', index= 3).click()631 >>> browser.getControl('Import!', index=1).click() 632 632 633 633 >>> print browser.contents … … 640 640 >>> browser.open('http://localhost/myuniversity/datacenter') 641 641 >>> browser.getLink('Import CSV data').click() 642 >>> browser.getControl('Import!', index= 4).click()642 >>> browser.getControl('Import!', index=0).click() 643 643 644 644 >>> print browser.contents -
waeup/branches/ulif-layout/src/waeup/datacenter.py
r4277 r4574 13 13 from zope.interface import Interface 14 14 from waeup.csvfile import getCSVFile 15 from waeup.interfaces import IWAeUPObject, IWAeUPCSVImporter, ICSVDataReceivers 15 from waeup.interfaces import (IWAeUPObject, IWAeUPCSVImporter, 16 ICSVDataReceivers, IDataCenterFile) 16 17 from waeup.utils.helpers import copyFileSystemTree 17 18 from waeup.viewlets import Index, MainArea, LeftSidebar … … 67 68 def getFiles(self): 68 69 """Get a list of files stored in `storage`. 70 71 Files are sorted by basename. 69 72 """ 70 73 result = [] 71 74 if not os.path.exists(self.storage): 72 75 return result 73 for filename in os.listdir(self.storage):76 for filename in sorted(os.listdir(self.storage)): 74 77 fullpath = os.path.join(self.storage, filename) 75 78 if not os.path.isfile(fullpath): … … 171 174 return 172 175 173 174 class IDataCenterFile(Interface):175 """A data center file.176 """177 pass178 179 180 176 class DataCenterFile(object): 181 177 """A description of a file stored in data center. -
waeup/branches/ulif-layout/src/waeup/datacenter.txt
r4225 r4574 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 -
waeup/branches/ulif-layout/src/waeup/interfaces.py
r4559 r4574 393 393 data, i.e. for which an IWAeUPCSVDataImporter exists. 394 394 """ 395 396 class 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.