- Timestamp:
- 28 Jan 2010, 09:29:49 (15 years ago)
- Location:
- waeup/branches/ulif-namespace/src/waeup/sirp
- Files:
-
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-namespace/src/waeup/sirp/README.txt
r4789 r4920 1 The waeup package2 ******************** 1 The waeup.sirp package 2 ********************** 3 3 4 4 :Test-Layer: unit … … 13 13 14 14 >>> import grok 15 >>> grok.testing.grok('waeup ')15 >>> grok.testing.grok('waeup.sirp') 16 16 17 17 Universities … … 23 23 We can easily create universities:: 24 24 25 >>> from waeup. app import University25 >>> from waeup.sirp.app import University 26 26 >>> u = University() 27 27 >>> u 28 <waeup. app.University object at 0x...>28 <waeup.sirp.app.University object at 0x...> 29 29 30 30 Universities have a name. … … 37 37 38 38 >>> u['faculties'] 39 <waeup. university.facultycontainer.FacultyContainer object at 0x...>39 <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...> 40 40 41 41 >>> u['students'] 42 <waeup.s tudent.studentcontainer.StudentContainer object at 0x...>42 <waeup.sirp.student.studentcontainer.StudentContainer object at 0x...> 43 43 44 44 >>> u['hostels'] 45 <waeup. hostel.hostelcontainer.HostelContainer object at 0x...>45 <waeup.sirp.hostel.hostelcontainer.HostelContainer object at 0x...> 46 46 47 47 We can export universities. For this we lookup an appropriate exporter 48 48 first:: 49 49 50 >>> from waeup. interfaces import IWAeUPExporter50 >>> from waeup.sirp.interfaces import IWAeUPExporter 51 51 >>> exporter = IWAeUPExporter(u) 52 52 >>> exporter 53 <waeup. utils.importexport.Exporter object at 0x...>53 <waeup.sirp.utils.importexport.Exporter object at 0x...> 54 54 55 55 Now we can trigger the export:: … … 62 62 memory file:: 63 63 64 >>> from waeup. interfaces import IWAeUPXMLExporter64 >>> from waeup.sirp.interfaces import IWAeUPXMLExporter 65 65 >>> exporter = IWAeUPXMLExporter(u) 66 66 >>> f = exporter.export() … … 84 84 We can create faculties easily:: 85 85 86 >>> from waeup. university.faculty import Faculty86 >>> from waeup.sirp.university.faculty import Faculty 87 87 >>> f = Faculty() 88 88 >>> f 89 <waeup. university.faculty.Faculty object at 0x...>89 <waeup.sirp.university.faculty.Faculty object at 0x...> 90 90 91 91 Also faculties want to be named:: -
waeup/branches/ulif-namespace/src/waeup/sirp/__init__.py
r4789 r4920 1 1 import grok 2 from waeup. interfaces import IWAeUPObject2 from waeup.sirp.interfaces import IWAeUPObject 3 3 from zope.annotation.attribute import AttributeAnnotations 4 4 from zope.annotation.interfaces import IAnnotations -
waeup/branches/ulif-namespace/src/waeup/sirp/app.py
r4884 r4920 6 6 from zope.component import createObject 7 7 8 from waeup. interfaces import (IUniversity, ICSVDataReceivers, IDataCenter,8 from waeup.sirp.interfaces import (IUniversity, ICSVDataReceivers, IDataCenter, 9 9 IDataCenterStorageMovedEvent) 10 from waeup. authentication import setup_authentication11 from waeup. datacenter import DataCenter12 from waeup. users import UserContainer10 from waeup.sirp.authentication import setup_authentication 11 from waeup.sirp.datacenter import DataCenter 12 from waeup.sirp.users import UserContainer 13 13 14 14 class University(grok.Application, grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/app.txt
r4789 r4920 1 :mod:`waeup. app` -- central components for a WAeUP portal2 ********************************************************* 1 :mod:`waeup.sirp.app` -- central components for a WAeUP portal 2 ************************************************************** 3 3 4 4 :Test-Layer: unit 5 5 6 .. module:: waeup. app6 .. module:: waeup.sirp.app 7 7 8 8 .. class:: University … … 20 20 An arbitrary object containing "faculties". In the case of 21 21 `University` it is a container of type 22 `waeup. interfaces.IFacultyContainer`.22 `waeup.sirp.interfaces.IFacultyContainer`. 23 23 24 24 … … 39 39 instance: 40 40 41 >>> from waeup. app import University41 >>> from waeup.sirp.app import University 42 42 >>> myuniversity = University() 43 43 >>> myuniversity 44 <waeup. app.University object at 0x...>44 <waeup.sirp.app.University object at 0x...> 45 45 46 46 Instances of `University` comply with the interface 47 `waeup. interfaces.IUniversity`:47 `waeup.sirp.interfaces.IUniversity`: 48 48 49 49 >>> from zope.interface.verify import verifyClass 50 >>> from waeup. interfaces import IUniversity50 >>> from waeup.sirp.interfaces import IUniversity 51 51 >>> verifyClass(IUniversity, University) 52 52 True … … 55 55 interface: 56 56 57 >>> from waeup. app import University57 >>> from waeup.sirp.app import University 58 58 >>> myuniversity = University() 59 59 >>> myuniversity.name … … 61 61 62 62 >>> myuniversity['faculties'] 63 <waeup. university.facultycontainer.FacultyContainer object at 0x...>63 <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...> -
waeup/branches/ulif-namespace/src/waeup/sirp/authentication.py
r4789 r4920 10 10 from zope.securitypolicy.interfaces import IPrincipalRoleManager 11 11 from zope.securitypolicy.principalrole import principalRoleManager 12 from waeup. interfaces import IUserAccount13 import waeup. permissions12 from waeup.sirp.interfaces import IUserAccount 13 import waeup.sirp.permissions 14 14 15 15 def setup_authentication(pau): -
waeup/branches/ulif-namespace/src/waeup/sirp/browser/__init__.py
r4789 r4920 1 from waeup. browser.layout import (WAeUPPage, WAeUPLayout, WAeUPDisplayFormPage,2 WAeUPEditFormPage, WAeUPAddFormPage,3 1 from waeup.sirp.browser.layout import ( 2 WAeUPPage, WAeUPLayout, WAeUPDisplayFormPage, WAeUPEditFormPage, 3 WAeUPAddFormPage, NullValidator) -
waeup/branches/ulif-namespace/src/waeup/sirp/browser/breadcrumbs.py
r4789 r4920 6 6 from zope.publisher.browser import TestRequest 7 7 8 from waeup import interfaces9 from waeup. browser.interfaces import (IBreadcrumb, IBreadcrumbIgnorable,8 from waeup.sirp import interfaces 9 from waeup.sirp.browser.interfaces import (IBreadcrumb, IBreadcrumbIgnorable, 10 10 IBreadcrumbContainer) 11 11 -
waeup/branches/ulif-namespace/src/waeup/sirp/browser/layout.py
r4789 r4920 4 4 from hurry import yui 5 5 from megrok.layout import Page, Layout, EditForm, DisplayForm, AddForm 6 from waeup. interfaces import IWAeUPObject6 from waeup.sirp.interfaces import IWAeUPObject 7 7 from z3c.flashmessage.interfaces import IMessageSource 8 8 from zope.component import queryUtility, ComponentLookupError -
waeup/branches/ulif-namespace/src/waeup/sirp/browser/pages.py
r4909 r4920 12 12 from hurry.query.query import Query, Text 13 13 from hurry.workflow.interfaces import NoTransitionAvailableError 14 from waeup. browser import (WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage,14 from waeup.sirp.browser import (WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage, 15 15 WAeUPDisplayFormPage, NullValidator) 16 from waeup. catalog import search, search_context17 from waeup. datacenter import Import18 from waeup. interfaces import (IUniversity, IWAeUPObject, IUserContainer,16 from waeup.sirp.catalog import search, search_context 17 from waeup.sirp.datacenter import Import 18 from waeup.sirp.interfaces import (IUniversity, IWAeUPObject, IUserContainer, 19 19 IUserAccount, IFacultyContainer, IDataCenter, 20 20 IFaculty, IDepartment, ICourse, ICertificate, 21 21 ICertificateCourse, IWAeUPXMLImporter, 22 22 IWAeUPXMLExporter) 23 from waeup. widgets.interfaces import ITableProvider24 from waeup. utils.helpers import getName23 from waeup.sirp.widgets.interfaces import ITableProvider 24 from waeup.sirp.utils.helpers import getName 25 25 from zope import schema 26 26 from zope.app.security.interfaces import (IAuthentication, … … 32 32 from zope.session.interfaces import ISession 33 33 34 from waeup. interfaces import IBatchProcessor34 from waeup.sirp.interfaces import IBatchProcessor 35 35 from zope.component import getAllUtilitiesRegisteredFor 36 36 -
waeup/branches/ulif-namespace/src/waeup/sirp/browser/viewlets.py
r4858 r4920 6 6 from zope.component import getMultiAdapter 7 7 from zope.location.interfaces import ISite 8 from waeup. browser.pages import (UniversityPage, FacultyContainerPage,8 from waeup.sirp.browser.pages import (UniversityPage, FacultyContainerPage, 9 9 DatacenterPage, FacultyPage, DepartmentPage, 10 10 CoursePage, CertificatePage, 11 11 CertificateCoursePage) 12 from waeup. browser.interfaces import IBreadcrumbContainer13 from waeup. interfaces import (IUniversity, IWAeUPObject, IWAeUPXMLExporter,12 from waeup.sirp.browser.interfaces import IBreadcrumbContainer 13 from waeup.sirp.interfaces import (IUniversity, IWAeUPObject, IWAeUPXMLExporter, 14 14 IWAeUPXMLImporter, IFacultyContainer, IFaculty, 15 15 IDepartment, ICourse, ICertificate, … … 164 164 165 165 # 166 # waeup. app.University viewlets...166 # waeup.sirp.app.University viewlets... 167 167 # 168 168 class Login(grok.Viewlet): -
waeup/branches/ulif-namespace/src/waeup/sirp/catalog.py
r4789 r4920 4 4 from hurry.query.query import Query, Text 5 5 from hurry.query import Eq 6 from waeup. app import University7 from waeup. interfaces import ICourse, ICertificateCourse8 from waeup.s tudent.interfaces import IStudent6 from waeup.sirp.app import University 7 from waeup.sirp.interfaces import ICourse, ICertificateCourse 8 from waeup.sirp.student.interfaces import IStudent 9 9 from zope.app.catalog.interfaces import ICatalog 10 10 from zope.app.intid.interfaces import IIntIds -
waeup/branches/ulif-namespace/src/waeup/sirp/csvfile/README.txt
r4789 r4920 1 :mod:`waeup. csvfile` -- generic support for handling CSV files2 ************************************************************** 1 :mod:`waeup.sirp.csvfile` -- generic support for handling CSV files 2 ******************************************************************* 3 3 4 4 :Test-Layer: unit 5 5 6 .. module:: waeup. csvfile6 .. module:: waeup.sirp.csvfile 7 7 :synopsis: generic support for handling CSV files. 8 8 … … 10 10 .. note:: 11 11 12 This version of the :mod:`waeup. csvfile` module doesn't support12 This version of the :mod:`waeup.sirp.csvfile` module doesn't support 13 13 Unicode input. Also, there are currently some issues regarding 14 14 ASCII NUL characters. Accordingly, all input should be UTF-8 or … … 125 125 The string can be uppercase, lowercase or mixed: 126 126 127 >>> from waeup. csvfile import toBool127 >>> from waeup.sirp.csvfile import toBool 128 128 >>> toBool('y') 129 129 True … … 149 149 ============= 150 150 151 To initialize the whole framework we have to grok the :mod:`waeup `151 To initialize the whole framework we have to grok the :mod:`waeup.sirp` 152 152 package first: 153 153 154 154 >>> import grok 155 >>> grok.testing.grok('waeup ')155 >>> grok.testing.grok('waeup.sirp') 156 156 157 157 Create a file: … … 168 168 object out of a path string: 169 169 170 >>> from waeup. csvfile.interfaces import ICSVFile170 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 171 171 >>> src = ICSVFile(path) 172 172 >>> src 173 <waeup. csvfile.csvfile.CSVFile object at 0x...>173 <waeup.sirp.csvfile.csvfile.CSVFile object at 0x...> 174 174 175 175 Create a receiver: 176 176 177 >>> from waeup. csvfile.interfaces import ICSVDataReceiver177 >>> from waeup.sirp.csvfile.interfaces import ICSVDataReceiver 178 178 >>> class Receiver(object): 179 179 ... grok.implements(ICSVDataReceiver) … … 186 186 187 187 >>> from zope.component import getMultiAdapter 188 >>> from waeup. csvfile.interfaces import ICSVDataConnector188 >>> from waeup.sirp.csvfile.interfaces import ICSVDataConnector 189 189 >>> conn = getMultiAdapter((src, recv), ICSVDataConnector) 190 190 Traceback (most recent call last): 191 191 ... 192 ComponentLookupError: ((<waeup. csvfile.csvfile.CSVFile object at 0x...>,192 ComponentLookupError: ((<waeup.sirp.csvfile.csvfile.CSVFile object at 0x...>, 193 193 <Receiver object at 0x...>), 194 <InterfaceClass waeup. csvfile.interfaces.ICSVDataConnector>, u'')194 <InterfaceClass waeup.sirp.csvfile.interfaces.ICSVDataConnector>, u'') 195 195 196 196 Okay, create a connector: … … 241 241 for an adapter to the path string: 242 242 243 >>> from waeup. csvfile.interfaces import ICSVFile243 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 244 244 >>> wrapper = ICSVFile(path) 245 245 >>> wrapper 246 <waeup. csvfile.csvfile.CSVFile object at 0x...>246 <waeup.sirp.csvfile.csvfile.CSVFile object at 0x...> 247 247 248 248 This wrapper can return the CSV data as a sequence of dicts: … … 271 271 use the :func:`getCSVFile` function: 272 272 273 >>> from waeup. csvfile.csvfile import getCSVFile273 >>> from waeup.sirp.csvfile.csvfile import getCSVFile 274 274 >>> wrapper = getCSVFile(path) 275 275 >>> wrapper 276 <waeup. csvfile.csvfile.CSVFile object at 0x...>276 <waeup.sirp.csvfile.csvfile.CSVFile object at 0x...> 277 277 278 278 As we currently have only one type of wrapper, we get this. Let's 279 279 create another wrapper, that requires a column 'col1': 280 280 281 >>> from waeup. csvfile.interfaces import ICSVFile282 >>> from waeup. csvfile import CSVFile281 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 282 >>> from waeup.sirp.csvfile import CSVFile 283 283 >>> class ICSVFileWithCol1(ICSVFile): 284 284 ... """A CSV file that contains a 'col1' column. … … 341 341 in constructor, whether this requirement is met: 342 342 343 >>> from waeup. csvfile.interfaces import ICSVFile344 >>> from waeup. csvfile import CSVFile343 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 344 >>> from waeup.sirp.csvfile import CSVFile 345 345 >>> class ICSVFile13(ICSVFile): 346 346 ... """A CSV file that contains a 'special_col' column. … … 370 370 We create a wrapper that requires 'col1' and 'col2': 371 371 372 >>> from waeup. csvfile.interfaces import ICSVFile373 >>> from waeup. csvfile import CSVFile372 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 373 >>> from waeup.sirp.csvfile import CSVFile 374 374 >>> class ICSVFile12(ICSVFile): 375 375 ... """A CSV file that contains a 'special_col' column. … … 390 390 path (i.e. __init__ raises some kind of exception): score is -1: 391 391 392 >>> from waeup. csvfile.csvfile import getScore392 >>> from waeup.sirp.csvfile.csvfile import getScore 393 393 >>> getScore('nonexistant', CSVFile) 394 394 -1 … … 426 426 427 427 >>> import grok 428 >>> from waeup. csvfile.interfaces import ICSVFile429 >>> from waeup. csvfile import CSVFile428 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 429 >>> from waeup.sirp.csvfile import CSVFile 430 430 431 431 >>> class ICustomCSVFile(ICSVFile): … … 501 501 Now we create a wrapper, that requires that field: 502 502 503 >>> from waeup. csvfile.interfaces import ICSVFile504 >>> from waeup. csvfile import CSVFile503 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 504 >>> from waeup.sirp.csvfile import CSVFile 505 505 >>> class ICSVFileWithSpecialCol(ICSVFile): 506 506 ... """A CSV file that contains a 'special_col' column. … … 629 629 before, using the :func:`getCSVFile` function: 630 630 631 >>> from waeup. csvfile import getCSVFile631 >>> from waeup.sirp.csvfile import getCSVFile 632 632 >>> myfile = getCSVFile(path) 633 633 >>> ICSVFile12.providedBy(myfile) -
waeup/branches/ulif-namespace/src/waeup/sirp/csvfile/__init__.py
r4789 r4920 1 1 # Make this a package. 2 from waeup. csvfile.csvfile import getCSVFile, CSVFile3 from waeup. csvfile.util import toBool2 from waeup.sirp.csvfile.csvfile import getCSVFile, CSVFile 3 from waeup.sirp.csvfile.util import toBool -
waeup/branches/ulif-namespace/src/waeup/sirp/csvfile/csvfile.py
r4789 r4920 6 6 import csv 7 7 import grok 8 from waeup. csvfile.interfaces import ICSVFile8 from waeup.sirp.csvfile.interfaces import ICSVFile 9 9 10 10 class CSVFile(grok.Adapter): -
waeup/branches/ulif-namespace/src/waeup/sirp/csvfile/meta.py
r4789 r4920 1 """Meta configuration for waeup. csvfile components.1 """Meta configuration for waeup.sirp.csvfile components. 2 2 """ 3 3 import martian 4 import waeup. csvfile.csvfile5 from waeup. csvfile import CSVFile4 import waeup.sirp.csvfile.csvfile 5 from waeup.sirp.csvfile import CSVFile 6 6 7 7 # This grokker fills the registry on startup, with any class that is … … 10 10 martian.component(CSVFile) 11 11 def execute(self, klass, **kw): 12 waeup. csvfile.csvfile.csvwrappers.append(klass)12 waeup.sirp.csvfile.csvfile.csvwrappers.append(klass) 13 13 return True -
waeup/branches/ulif-namespace/src/waeup/sirp/datacenter.py
r4908 r4920 12 12 from zope.component import getMultiAdapter 13 13 from zope.component.interfaces import ObjectEvent 14 from waeup. csvfile import getCSVFile15 from waeup. interfaces import (IDataCenter, IWAeUPCSVImporter,14 from waeup.sirp.csvfile import getCSVFile 15 from waeup.sirp.interfaces import (IDataCenter, IWAeUPCSVImporter, 16 16 ICSVDataReceivers, IDataCenterFile, 17 17 IDataCenterStorageMovedEvent) 18 from waeup. utils.helpers import copyFileSystemTree18 from waeup.sirp.utils.helpers import copyFileSystemTree 19 19 20 20 class DataCenter(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/datacenter.txt
r4907 r4920 11 11 A data center can be created easily: 12 12 13 >>> from waeup. datacenter import DataCenter13 >>> from waeup.sirp.datacenter import DataCenter 14 14 >>> mydatacenter = DataCenter() 15 15 >>> mydatacenter 16 <waeup. datacenter.DataCenter object at 0x...>16 <waeup.sirp.datacenter.DataCenter object at 0x...> 17 17 18 18 Each data center has a location in file system where files are stored: … … 20 20 >>> storagepath = mydatacenter.storage 21 21 >>> storagepath 22 '/.../ src/waeup/files'22 '/.../waeup/sirp/files' 23 23 24 24 … … 77 77 78 78 >>> mydatacenter.getFiles() 79 [<waeup. datacenter.DataCenterFile object at 0x...>]79 [<waeup.sirp.datacenter.DataCenterFile object at 0x...>] 80 80 81 81 As we can see, the actual file is wrapped by a convenience wrapper, … … 282 282 283 283 >>> import grok 284 >>> from waeup. interfaces import ICSVDataReceivers285 >>> from waeup. datacenter import DataCenter284 >>> from waeup.sirp.interfaces import ICSVDataReceivers 285 >>> from waeup.sirp.datacenter import DataCenter 286 286 >>> class SomeContainer(grok.Container): 287 287 ... grok.implements(ICSVDataReceivers) … … 302 302 to import data into instances of MyCSVReceiver: 303 303 304 >>> from waeup. csvfile.interfaces import ICSVFile305 >>> from waeup. interfaces import IWAeUPCSVImporter306 >>> from waeup. utils.importexport import CSVImporter304 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 305 >>> from waeup.sirp.interfaces import IWAeUPCSVImporter 306 >>> from waeup.sirp.utils.importexport import CSVImporter 307 307 >>> class MyCSVImporter(CSVImporter): 308 308 ... grok.adapts(ICSVFile, MyCSVReceiver) -
waeup/branches/ulif-namespace/src/waeup/sirp/hostel/hostel.py
r4789 r4920 1 1 import grok 2 from waeup. interfaces import IHostel2 from waeup.sirp.interfaces import IHostel 3 3 4 4 class Hostel(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/hostel/hostelcontainer.py
r4789 r4920 2 2 from zope.component.interfaces import IFactory 3 3 from zope.interface import implementedBy 4 from waeup. interfaces import IHostelContainer, IHostel4 from waeup.sirp.interfaces import IHostelContainer, IHostel 5 5 6 6 class HostelContainer(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/hostel/hostelcontainer.txt
r4789 r4920 1 waeup. hostel.HostelContainer2 **************************** 1 waeup.sirp.hostel.HostelContainer 2 ********************************* 3 3 4 4 Containers for hostels. … … 11 11 We can easily create `HostelContainers`:: 12 12 13 >>> from waeup. hostel.hostelcontainer import HostelContainer13 >>> from waeup.sirp.hostel.hostelcontainer import HostelContainer 14 14 >>> mycontainer = HostelContainer() 15 15 16 16 Hostel containers provide ``IHostelContainer``: 17 17 18 >>> from waeup. interfaces import IHostelContainer18 >>> from waeup.sirp.interfaces import IHostelContainer 19 19 >>> IHostelContainer.providedBy(mycontainer) 20 20 True … … 31 31 >>> from zope.component import createObject 32 32 >>> createObject(u'waeup.HostelContainer') 33 <waeup. hostel.hostelcontainer.HostelContainer object at 0x...>33 <waeup.sirp.hostel.hostelcontainer.HostelContainer object at 0x...> 34 34 35 35 This way we get a thing that implements IHostelContainer without … … 57 57 Okay, so we have to get a hostel first:: 58 58 59 >>> from waeup. hostel.hostel import Hostel59 >>> from waeup.sirp.hostel.hostel import Hostel 60 60 >>> myhostel = Hostel() 61 61 -
waeup/branches/ulif-namespace/src/waeup/sirp/interfaces.py
r4882 r4920 8 8 from zope import schema 9 9 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm 10 from waeup. permissions import RoleSource10 from waeup.sirp.permissions import RoleSource 11 11 12 12 class FatalCSVError(Exception): -
waeup/branches/ulif-namespace/src/waeup/sirp/permissions.txt
r4789 r4920 16 16 We can get all roles defined in a WAeUP portal: 17 17 18 >>> from waeup. permissions import getRoles18 >>> from waeup.sirp.permissions import getRoles 19 19 >>> getRoles() 20 20 ['waeup.PortalManager', 'waeup.PortalUser'] -
waeup/branches/ulif-namespace/src/waeup/sirp/student/student.py
r4789 r4920 1 1 import grok 2 2 from grok import index 3 from waeup.s tudent.interfaces import IStudent3 from waeup.sirp.student.interfaces import IStudent 4 4 5 5 def fromCsv(a): -
waeup/branches/ulif-namespace/src/waeup/sirp/student/studentcontainer.py
r4789 r4920 3 3 from zope.component.interfaces import IFactory 4 4 from zope.interface import implementedBy 5 from waeup. interfaces import IStudentContainer6 from waeup. utils import importexport as csv5 from waeup.sirp.interfaces import IStudentContainer 6 from waeup.sirp.utils import importexport as csv 7 7 8 8 class StudentContainer(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/tables.py
r4789 r4920 2 2 """ 3 3 import grok 4 from waeup. interfaces import (IUniversity, IFacultyContainer, IFaculty,4 from waeup.sirp.interfaces import (IUniversity, IFacultyContainer, IFaculty, 5 5 IDepartment, ICourseContainer) 6 from waeup. widgets.interfaces import ITableProvider7 from waeup. widgets.table import YUITable as Table8 from waeup. widgets.table import Col6 from waeup.sirp.widgets.interfaces import ITableProvider 7 from waeup.sirp.widgets.table import YUITable as Table 8 from waeup.sirp.widgets.table import Col 9 9 from zope.security.management import checkPermission 10 10 -
waeup/branches/ulif-namespace/src/waeup/sirp/testing.py
r4789 r4920 1 1 import os.path 2 import waeup 2 import waeup.sirp 3 3 from zope.app.testing.functional import ZCMLLayer 4 4 5 5 ftesting_zcml = os.path.join( 6 os.path.dirname(waeup. __file__), 'ftesting.zcml')6 os.path.dirname(waeup.sirp.__file__), 'ftesting.zcml') 7 7 FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer', 8 8 allow_teardown=True) -
waeup/branches/ulif-namespace/src/waeup/sirp/tests/test_waeup.py
r4789 r4920 2 2 ## test_waeuptest.py 3 3 """ 4 Test setup for the waeup package.4 Test setup for the waeup.sirp package. 5 5 """ 6 6 import grok 7 7 import zope.component.eventtesting 8 from waeup. testing import FunctionalLayer8 from waeup.sirp.testing import FunctionalLayer 9 9 10 10 def setUpZope(test): … … 13 13 # Register all tests in the waeup_ng package 14 14 test_suite = grok.testing.register_all_tests( 15 'waeup ', usetup=setUpZope,15 'waeup.sirp', usetup=setUpZope, 16 16 layer=FunctionalLayer) -
waeup/branches/ulif-namespace/src/waeup/sirp/university/certificate.py
r4864 r4920 7 7 from zope.component.interfaces import IFactory, ComponentLookupError 8 8 from zope.interface import implementedBy 9 from waeup. interfaces import ICertificate, ICertificateCourse, ICourse9 from waeup.sirp.interfaces import ICertificate, ICertificateCourse, ICourse 10 10 11 11 class Certificate(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/university/certificate.txt
r4867 r4920 1 :mod:`waeup. university.certificate` -- Certificates for WAeUP2 ************************************************************* 3 4 .. module:: waeup. university.certificate1 :mod:`waeup.sirp.university.certificate` -- Certificates for WAeUP 2 ****************************************************************** 3 4 .. module:: waeup.sirp.university.certificate 5 5 6 6 Components that represent and manage certificates. … … 31 31 All parameters are optional: 32 32 33 >>> from waeup. university.certificate import Certificate33 >>> from waeup.sirp.university.certificate import Certificate 34 34 >>> mycertificate = Certificate() 35 35 36 36 Certificates have the attributes required by the `ICertificate` interface: 37 37 38 >>> from waeup. interfaces import ICertificate38 >>> from waeup.sirp.interfaces import ICertificate 39 39 >>> ICertificate.providedBy(mycertificate) 40 40 True … … 164 164 165 165 Add a reference to a course. A course is an object implementing 166 :class:`waeup. interfaces.ICourse`.166 :class:`waeup.sirp.interfaces.ICourse`. 167 167 168 168 Please don't be confused by the term 'reference'. This just 169 means an ordinary :class:`waeup. university.course.Course` object169 means an ordinary :class:`waeup.sirp.university.course.Course` object 170 170 in almost all cases. As this object will normaly be one stored 171 171 in a department, the course here will simply become a reference … … 226 226 >>> mycertificate = createObject(u'waeup.Certificate') 227 227 >>> mycertificate 228 <waeup. university.certificate.Certificate object at 0x...>228 <waeup.sirp.university.certificate.Certificate object at 0x...> 229 229 230 230 The factory complies with the specifications from the … … 233 233 >>> from zope.interface.verify import verifyClass 234 234 >>> from zope.component.interfaces import IFactory 235 >>> from waeup. university.certificate import CertificateFactory235 >>> from waeup.sirp.university.certificate import CertificateFactory 236 236 >>> verifyClass(IFactory, CertificateFactory) 237 237 True … … 242 242 >>> certificate_factory = CertificateFactory() 243 243 >>> certificate_factory.getInterfaces() 244 <implementedBy waeup. university.certificate.Certificate>244 <implementedBy waeup.sirp.university.certificate.Certificate> 245 245 246 246 … … 260 260 >>> mycertificatecourse = createObject(u'waeup.CertificateCourse') 261 261 >>> mycertificatecourse 262 <waeup. university.certificate.CertificateCourse object at 0x...>262 <waeup.sirp.university.certificate.CertificateCourse object at 0x...> 263 263 264 264 The factory complies with the specifications from the … … 267 267 >>> from zope.interface.verify import verifyClass 268 268 >>> from zope.component.interfaces import IFactory 269 >>> from waeup. university.certificate import CertificateCourseFactory269 >>> from waeup.sirp.university.certificate import CertificateCourseFactory 270 270 >>> verifyClass(IFactory, CertificateCourseFactory) 271 271 True … … 276 276 >>> certcourse_factory = CertificateCourseFactory() 277 277 >>> certcourse_factory.getInterfaces() 278 <implementedBy waeup. university.certificate.CertificateCourse>278 <implementedBy waeup.sirp.university.certificate.CertificateCourse> 279 279 280 280 … … 311 311 We can create certificates: 312 312 313 >>> from waeup. university.certificate import Certificate313 >>> from waeup.sirp.university.certificate import Certificate 314 314 >>> mycertificate = Certificate() 315 315 >>> mycertificate 316 <waeup. university.certificate.Certificate object at 0x...>316 <waeup.sirp.university.certificate.Certificate object at 0x...> 317 317 318 318 Another way to create certificates is by asking for a factory called … … 323 323 >>> mycertificate = createObject(u'waeup.Certificate') 324 324 >>> mycertificate 325 <waeup. university.certificate.Certificate object at 0x...>325 <waeup.sirp.university.certificate.Certificate object at 0x...> 326 326 327 327 CertificateCourses … … 331 331 :class:`ICertificateCourse` interface: 332 332 333 >>> from waeup. interfaces import ICertificateCourse334 >>> from waeup. university.certificate import CertificateCourse333 >>> from waeup.sirp.interfaces import ICertificateCourse 334 >>> from waeup.sirp.university.certificate import CertificateCourse 335 335 >>> mycertcourse = CertificateCourse(None, 200, False) 336 336 >>> ICertificateCourse.providedBy(mycertcourse) … … 347 347 >>> mycertcourse = createObject(u'waeup.CertificateCourse') 348 348 >>> mycertcourse 349 <waeup. university.certificate.CertificateCourse object at 0x...>349 <waeup.sirp.university.certificate.CertificateCourse object at 0x...> 350 350 351 351 .. _removecertificatecourses: -
waeup/branches/ulif-namespace/src/waeup/sirp/university/certificatecontainer.py
r4789 r4920 2 2 """ 3 3 import grok 4 from waeup. interfaces import ICertificateContainer, ICertificate4 from waeup.sirp.interfaces import ICertificateContainer, ICertificate 5 5 from zope.component.interfaces import IFactory 6 6 from zope.interface import implementedBy -
waeup/branches/ulif-namespace/src/waeup/sirp/university/certificatecontainer.txt
r4789 r4920 1 :mod:`waeup. university.certificatecontainer` -- Certificate containers2 ********************************************************************** 1 :mod:`waeup.sirp.university.certificatecontainer` -- Certificate containers 2 *************************************************************************** 3 3 4 .. module:: waeup. university.certificatecontainer4 .. module:: waeup.sirp.university.certificatecontainer 5 5 6 6 Containers for certificates. … … 32 32 :class:`CertificateContainer` instances are instances of 33 33 :class:`grok.Container` that hold and manage instances of 34 :class:`waeup. university.certificate.Certificate`.34 :class:`waeup.sirp.university.certificate.Certificate`. 35 35 36 >>> from waeup. university.certificatecontainer import CertificateContainer36 >>> from waeup.sirp.university.certificatecontainer import CertificateContainer 37 37 >>> mycontainer = CertificateContainer() 38 38 >>> mycontainer 39 <waeup. university.certificatecontainer.CertificateContainer object at 0x...>39 <waeup.sirp.university.certificatecontainer.CertificateContainer object at 0x...> 40 40 41 41 Certificate containers provide `ICertificateContainer`: 42 42 43 >>> from waeup. interfaces import ICertificateContainer43 >>> from waeup.sirp.interfaces import ICertificateContainer 44 44 >>> ICertificateContainer.providedBy(mycontainer) 45 45 True … … 63 63 64 64 *certificate* must be an instance of 65 :class:`waeup. university.certificate.Certificate`:65 :class:`waeup.sirp.university.certificate.Certificate`: 66 66 67 >>> from waeup. university.certificatecontainer import (67 >>> from waeup.sirp.university.certificatecontainer import ( 68 68 ... CertificateContainer) 69 69 >>> mycontainer = CertificateContainer() … … 75 75 The key of added items is the ``code`` attribute: 76 76 77 >>> from waeup. university.certificate import Certificate77 >>> from waeup.sirp.university.certificate import Certificate 78 78 >>> mycertificate = Certificate(code='CERTIFICATE1') 79 79 >>> mycontainer.addCertificate(mycertificate) … … 110 110 >>> mycertificatecontainer = createObject(u'waeup.CertificateContainer') 111 111 >>> mycertificatecontainer 112 <waeup. university.certificatecontainer.CertificateContainer object at 0x...>112 <waeup.sirp.university.certificatecontainer.CertificateContainer object at 0x...> 113 113 114 114 The factory complies with the specifications from the … … 117 117 >>> from zope.interface.verify import verifyClass 118 118 >>> from zope.component.interfaces import IFactory 119 >>> from waeup. university.certificatecontainer import (119 >>> from waeup.sirp.university.certificatecontainer import ( 120 120 ... CertificateContainerFactory) 121 121 >>> verifyClass(IFactory, CertificateContainerFactory) … … 127 127 >>> certificatecontainer_factory = CertificateContainerFactory() 128 128 >>> certificatecontainer_factory.getInterfaces() 129 <implementedBy waeup. university.certificatecontainer.CertificateContainer>129 <implementedBy waeup.sirp.university.certificatecontainer.CertificateContainer> 130 130 131 131 … … 138 138 We can easily create `CertificateContainers`: 139 139 140 >>> from waeup. university.certificatecontainer import CertificateContainer140 >>> from waeup.sirp.university.certificatecontainer import CertificateContainer 141 141 >>> mycontainer = CertificateContainer() 142 142 … … 149 149 >>> from zope.component import createObject 150 150 >>> createObject(u'waeup.CertificateContainer') 151 <waeup. university.certificatecontainer.CertificateContainer object at 0x...>151 <waeup.sirp.university.certificatecontainer.CertificateContainer object at 0x...> 152 152 153 153 This way we get a thing that implements ICertificateContainer without -
waeup/branches/ulif-namespace/src/waeup/sirp/university/course.py
r4789 r4920 4 4 from zope.interface import implementedBy 5 5 from zope.component.interfaces import IFactory 6 from waeup. interfaces import ICourse6 from waeup.sirp.interfaces import ICourse 7 7 8 8 class Course(grok.Model): -
waeup/branches/ulif-namespace/src/waeup/sirp/university/course.txt
r4789 r4920 1 :mod:`waeup. university.course` -- Courses2 ***************************************** 1 :mod:`waeup.sirp.university.course` -- Courses 2 ********************************************** 3 3 4 .. module:: waeup. university.course4 .. module:: waeup.sirp.university.course 5 5 6 6 Components that represent courses. … … 30 30 All parameters are optional: 31 31 32 >>> from waeup. university.course import Course32 >>> from waeup.sirp.university.course import Course 33 33 >>> mycourse = Course() 34 34 >>> mycourse 35 <waeup. university.course.Course object at 0x...>35 <waeup.sirp.university.course.Course object at 0x...> 36 36 37 37 Course instances have the attributes required by the 38 :class:`waeup. interfaces.ICourse` interface:38 :class:`waeup.sirp.interfaces.ICourse` interface: 39 39 40 >>> from waeup. interfaces import ICourse40 >>> from waeup.sirp.interfaces import ICourse 41 41 >>> ICourse.providedBy(mycourse) 42 42 True … … 115 115 >>> mycourse = createObject(u'waeup.Course') 116 116 >>> mycourse 117 <waeup. university.course.Course object at 0x...>117 <waeup.sirp.university.course.Course object at 0x...> 118 118 119 119 The factory complies with the specifications from the … … 122 122 >>> from zope.interface.verify import verifyClass 123 123 >>> from zope.component.interfaces import IFactory 124 >>> from waeup. university.course import CourseFactory124 >>> from waeup.sirp.university.course import CourseFactory 125 125 >>> verifyClass(IFactory, CourseFactory) 126 126 True … … 131 131 >>> course_factory = CourseFactory() 132 132 >>> course_factory.getInterfaces() 133 <implementedBy waeup. university.course.Course>133 <implementedBy waeup.sirp.university.course.Course> 134 134 135 135 Examples … … 142 142 class and calling the constructor: 143 143 144 >>> from waeup. university.course import Course144 >>> from waeup.sirp.university.course import Course 145 145 >>> mycourse = Course() 146 146 >>> mycourse 147 <waeup. university.course.Course object at 0x...>147 <waeup.sirp.university.course.Course object at 0x...> 148 148 149 149 Another way to create courses is by asking for a factory called … … 154 154 >>> mycourse = createObject(u'waeup.Course') 155 155 >>> mycourse 156 <waeup. university.course.Course object at 0x...>156 <waeup.sirp.university.course.Course object at 0x...> 157 157 -
waeup/branches/ulif-namespace/src/waeup/sirp/university/coursecontainer.py
r4789 r4920 4 4 from zope.interface import implementedBy 5 5 from zope.component.interfaces import IFactory 6 from waeup. interfaces import ICourseContainer, ICourse6 from waeup.sirp.interfaces import ICourseContainer, ICourse 7 7 8 8 class CourseContainer(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/university/coursecontainer.txt
r4789 r4920 1 :mod:`waeup. university.coursecontainer` -- Course containers2 ************************************************************ 1 :mod:`waeup.sirp.university.coursecontainer` -- Course containers 2 ***************************************************************** 3 3 4 .. module:: waeup. university.coursecontainer4 .. module:: waeup.sirp.university.coursecontainer 5 5 6 6 Containers for courses. … … 32 32 :class:`CourseContainer` instances are instances of 33 33 :class:`grok.Container` that hold and manage instances of 34 :class:`waeup. university.course.Course`.34 :class:`waeup.sirp.university.course.Course`. 35 35 36 >>> from waeup. university.coursecontainer import CourseContainer36 >>> from waeup.sirp.university.coursecontainer import CourseContainer 37 37 >>> mycontainer = CourseContainer() 38 38 >>> mycontainer 39 <waeup. university.coursecontainer.CourseContainer object at 0x...>39 <waeup.sirp.university.coursecontainer.CourseContainer object at 0x...> 40 40 41 41 Course containers provide `ICourseContainer`: 42 42 43 >>> from waeup. interfaces import ICourseContainer43 >>> from waeup.sirp.interfaces import ICourseContainer 44 44 >>> ICourseContainer.providedBy(mycontainer) 45 45 True … … 63 63 64 64 *course* must be an instance of 65 :class:`waeup. university.course.Course`:65 :class:`waeup.sirp.university.course.Course`: 66 66 67 >>> from waeup. university.coursecontainer import CourseContainer67 >>> from waeup.sirp.university.coursecontainer import CourseContainer 68 68 >>> mycontainer = CourseContainer() 69 69 >>> mycontainer.addCourse('blah') … … 74 74 The key of added items is the ``code`` attribute: 75 75 76 >>> from waeup. university.course import Course76 >>> from waeup.sirp.university.course import Course 77 77 >>> mycourse = Course(code='COURSE1') 78 78 >>> mycontainer.addCourse(mycourse) … … 109 109 >>> mycoursecontainer = createObject(u'waeup.CourseContainer') 110 110 >>> mycoursecontainer 111 <waeup. university.coursecontainer.CourseContainer object at 0x...>111 <waeup.sirp.university.coursecontainer.CourseContainer object at 0x...> 112 112 113 113 The factory complies with the specifications from the … … 116 116 >>> from zope.interface.verify import verifyClass 117 117 >>> from zope.component.interfaces import IFactory 118 >>> from waeup. university.coursecontainer import CourseContainerFactory118 >>> from waeup.sirp.university.coursecontainer import CourseContainerFactory 119 119 >>> verifyClass(IFactory, CourseContainerFactory) 120 120 True … … 125 125 >>> coursecontainer_factory = CourseContainerFactory() 126 126 >>> coursecontainer_factory.getInterfaces() 127 <implementedBy waeup. university.coursecontainer.CourseContainer>127 <implementedBy waeup.sirp.university.coursecontainer.CourseContainer> 128 128 129 129 … … 136 136 We can easily create `CourseContainers`: 137 137 138 >>> from waeup. university.coursecontainer import CourseContainer138 >>> from waeup.sirp.university.coursecontainer import CourseContainer 139 139 >>> mycontainer = CourseContainer() 140 140 … … 147 147 >>> from zope.component import createObject 148 148 >>> createObject(u'waeup.CourseContainer') 149 <waeup. university.coursecontainer.CourseContainer object at 0x...>149 <waeup.sirp.university.coursecontainer.CourseContainer object at 0x...> 150 150 151 151 This way we get a thing that implements ICourseContainer without -
waeup/branches/ulif-namespace/src/waeup/sirp/university/department.py
r4789 r4920 5 5 from zope.component.interfaces import IFactory 6 6 from zope.interface import implementedBy 7 from waeup. interfaces import IDepartment7 from waeup.sirp.interfaces import IDepartment 8 8 9 9 class Department(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/university/department.txt
r4789 r4920 1 :mod:`waeup. university.department` -- Departments2 ************************************************* 1 :mod:`waeup.sirp.university.department` -- Departments 2 ****************************************************** 3 3 4 .. module:: waeup. university.department4 .. module:: waeup.sirp.university.department 5 5 6 6 Components that represent university departments. … … 26 26 Create a representation of a university department: 27 27 28 >>> from waeup. university.department import Department28 >>> from waeup.sirp.university.department import Department 29 29 >>> mydept = Department() 30 30 >>> mydept 31 <waeup. university.department.Department object at 0x...>31 <waeup.sirp.university.department.Department object at 0x...> 32 32 33 33 Another way to create :class:`Department` instances is by asking 34 for a factory called ``waeup. Department``. This way we can create a34 for a factory called ``waeup.sirp.Department``. This way we can create a 35 35 department without importing a class: 36 36 … … 38 38 >>> mydept = createObject(u'waeup.Department') 39 39 >>> mydept 40 <waeup. university.department.Department object at 0x...>40 <waeup.sirp.university.department.Department object at 0x...> 41 41 42 42 :class:`Department` instances have the attributes required by the 43 43 `IDepartment` interface: 44 44 45 >>> from waeup. interfaces import IDepartment45 >>> from waeup.sirp.interfaces import IDepartment 46 46 >>> IDepartment.providedBy(mydept) 47 47 True … … 92 92 93 93 >>> mydept.courses 94 <waeup. university.coursecontainer.CourseContainer object at 0x...>94 <waeup.sirp.university.coursecontainer.CourseContainer object at 0x...> 95 95 96 96 … … 103 103 104 104 >>> mydept.certificates 105 <waeup. ..certificatecontainer.CertificateContainer object at 0x...>105 <waeup.sirp...certificatecontainer.CertificateContainer object at 0x...> 106 106 107 107 Utilities … … 123 123 >>> mydepartment = createObject(u'waeup.Department') 124 124 >>> mydepartment 125 <waeup. university.department.Department object at 0x...>125 <waeup.sirp.university.department.Department object at 0x...> 126 126 127 127 The factory complies with the specifications from the … … 130 130 >>> from zope.interface.verify import verifyClass 131 131 >>> from zope.component.interfaces import IFactory 132 >>> from waeup. university.department import DepartmentFactory132 >>> from waeup.sirp.university.department import DepartmentFactory 133 133 >>> verifyClass(IFactory, DepartmentFactory) 134 134 True … … 139 139 >>> department_factory = DepartmentFactory() 140 140 >>> department_factory.getInterfaces() 141 <implementedBy waeup. university.department.Department>141 <implementedBy waeup.sirp.university.department.Department> -
waeup/branches/ulif-namespace/src/waeup/sirp/university/faculty.py
r4789 r4920 5 5 from zope.component.interfaces import IFactory 6 6 from zope.interface import implementedBy 7 from waeup. interfaces import IFaculty, IDepartment7 from waeup.sirp.interfaces import IFaculty, IDepartment 8 8 9 9 class Faculty(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/university/faculty.txt
r4789 r4920 1 :mod:`waeup. university.faculty` -- Faculties2 ******************************************** 3 4 .. module:: waeup. university.faculty1 :mod:`waeup.sirp.university.faculty` -- Faculties 2 ************************************************* 3 4 .. module:: waeup.sirp.university.faculty 5 5 6 6 Components that represent university faculties. … … 25 25 Create a representation of a university faculty: 26 26 27 >>> from waeup. university.faculty import Faculty27 >>> from waeup.sirp.university.faculty import Faculty 28 28 >>> myfac = Faculty() 29 29 >>> myfac 30 <waeup. university.faculty.Faculty object at 0x...>30 <waeup.sirp.university.faculty.Faculty object at 0x...> 31 31 32 32 Another way to create :class:`Faculty` instances is by asking … … 37 37 >>> myfac = createObject(u'waeup.Faculty') 38 38 >>> myfac 39 <waeup. university.faculty.Faculty object at 0x...>39 <waeup.sirp.university.faculty.Faculty object at 0x...> 40 40 41 41 :class:`Faculty` instances have the attributes required by the 42 42 `IFaculty` interface: 43 43 44 >>> from waeup. interfaces import IFaculty44 >>> from waeup.sirp.interfaces import IFaculty 45 45 >>> IFaculty.providedBy(myfac) 46 46 True … … 66 66 Regular departments are accepted: 67 67 68 >>> from waeup. university.department import Department68 >>> from waeup.sirp.university.department import Department 69 69 >>> myfac.addDepartment(Department(title='Physics', 70 70 ... code='DP')) 71 71 72 72 >>> list(myfac.items()) 73 [(u'DP', <waeup. university.department.Department object at 0x...>)]73 [(u'DP', <waeup.sirp.university.department.Department object at 0x...>)] 74 74 75 75 .. method:: clear() … … 132 132 >>> myfaculty = createObject(u'waeup.Faculty') 133 133 >>> myfaculty 134 <waeup. university.faculty.Faculty object at 0x...>134 <waeup.sirp.university.faculty.Faculty object at 0x...> 135 135 136 136 The factory complies with the specifications from the … … 139 139 >>> from zope.interface.verify import verifyClass 140 140 >>> from zope.component.interfaces import IFactory 141 >>> from waeup. university.faculty import FacultyFactory141 >>> from waeup.sirp.university.faculty import FacultyFactory 142 142 >>> verifyClass(IFactory, FacultyFactory) 143 143 True … … 148 148 >>> faculty_factory = FacultyFactory() 149 149 >>> faculty_factory.getInterfaces() 150 <implementedBy waeup. university.faculty.Faculty>150 <implementedBy waeup.sirp.university.faculty.Faculty> 151 151 152 152 … … 156 156 We can create faculties: 157 157 158 >>> from waeup. university.faculty import Faculty158 >>> from waeup.sirp.university.faculty import Faculty 159 159 >>> myfaculty = Faculty() 160 160 >>> myfaculty 161 <waeup. university.faculty.Faculty object at 0x...>161 <waeup.sirp.university.faculty.Faculty object at 0x...> 162 162 163 163 Another way to create faculties is by asking for a factory called … … 168 168 >>> myfaculty = createObject(u'waeup.Faculty') 169 169 >>> myfaculty 170 <waeup. university.faculty.Faculty object at 0x...>170 <waeup.sirp.university.faculty.Faculty object at 0x...> 171 171 172 172 Faculty attributes … … 175 175 Faculties have the attributes required by the `IFaculty` interface: 176 176 177 >>> from waeup. interfaces import IFaculty177 >>> from waeup.sirp.interfaces import IFaculty 178 178 >>> IFaculty.providedBy(myfaculty) 179 179 True -
waeup/branches/ulif-namespace/src/waeup/sirp/university/facultycontainer.py
r4789 r4920 2 2 from zope.component.interfaces import IFactory 3 3 from zope.interface import implementedBy 4 from waeup. interfaces import IFacultyContainer, IFaculty4 from waeup.sirp.interfaces import IFacultyContainer, IFaculty 5 5 6 6 class FacultyContainer(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/university/facultycontainer.txt
r4789 r4920 11 11 We can easily create `FacultyContainers`:: 12 12 13 >>> from waeup. university.facultycontainer import FacultyContainer13 >>> from waeup.sirp.university.facultycontainer import FacultyContainer 14 14 >>> mycontainer = FacultyContainer() 15 15 16 16 Faculty containers provide `IFacultyContainer`: 17 17 18 >>> from waeup. interfaces import IFacultyContainer18 >>> from waeup.sirp.interfaces import IFacultyContainer 19 19 >>> IFacultyContainer.providedBy(mycontainer) 20 20 True … … 31 31 >>> from zope.component import createObject 32 32 >>> createObject(u'waeup.FacultyContainer') 33 <waeup. university.facultycontainer.FacultyContainer object at 0x...>33 <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...> 34 34 35 35 This way we get a thing that implements IFacultyContainer without … … 57 57 Okay, so we have to get a faculty first:: 58 58 59 >>> from waeup. university.faculty import Faculty59 >>> from waeup.sirp.university.faculty import Faculty 60 60 >>> myfaculty = Faculty() 61 61 -
waeup/branches/ulif-namespace/src/waeup/sirp/users.py
r4789 r4920 2 2 """ 3 3 import grok 4 from waeup. authentication import Account5 from waeup. interfaces import IUserContainer4 from waeup.sirp.authentication import Account 5 from waeup.sirp.interfaces import IUserContainer 6 6 7 7 class UserContainer(grok.Container): -
waeup/branches/ulif-namespace/src/waeup/sirp/users.txt
r4789 r4920 16 16 us: 17 17 18 >>> from waeup. users import UserContainer18 >>> from waeup.sirp.users import UserContainer 19 19 >>> myusers = UserContainer() 20 20 … … 33 33 >>> bob = myusers['bob'] 34 34 >>> bob 35 <waeup. authentication.Account object at 0x...>35 <waeup.sirp.authentication.Account object at 0x...> 36 36 37 37 >>> bob.name -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/batching.py
r4911 r4920 15 15 from zope.schema import getFields 16 16 from zope.schema.interfaces import IText 17 from waeup. interfaces import (IBatchProcessor, IFacultyContainer, IFaculty,17 from waeup.sirp.interfaces import (IBatchProcessor, IFacultyContainer, IFaculty, 18 18 ICourse, IDepartment, ICertificate, 19 19 ICertificateCourse, ISchemaTypeConverter, -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/converters.py
r4858 r4920 9 9 from zope.browser.interfaces import ITerms 10 10 from zope.schema.interfaces import IBool, IText, IInt, IChoice 11 from waeup. interfaces import ISchemaTypeConverter11 from waeup.sirp.interfaces import ISchemaTypeConverter 12 12 13 13 # If a string has this value, it is considered as 'missing_value' or None. -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/converters.txt
r4858 r4920 1 :mod:`waeup. utils.converters` -- Converters2 ******************************************* 3 4 .. module:: waeup. utils.converters1 :mod:`waeup.sirp.utils.converters` -- Converters 2 ************************************************ 3 4 .. module:: waeup.sirp.utils.converters 5 5 6 6 Converters for :mod:`zope.schema` based data. … … 25 25 'non-values'. Current setting is: 26 26 27 >>> from waeup. utils.converters import NONE_STRING_VALUE27 >>> from waeup.sirp.utils.converters import NONE_STRING_VALUE 28 28 >>> NONE_STRING_VALUE 29 29 '' … … 36 36 ======== 37 37 38 The :mod:`waeup. utils.converters` module is basically a collection of38 The :mod:`waeup.sirp.utils.converters` module is basically a collection of 39 39 adapters for field types of :mod:`zope.schema`. 40 40 … … 52 52 `zope.schema.Choice` or similar. 53 53 54 .. method:: provides(waeup. interfaces.ISchemaTypeConverter)54 .. method:: provides(waeup.sirp.interfaces.ISchemaTypeConverter) 55 55 56 56 .. method:: _convertValueFromString(string) … … 115 115 .. method:: adapts(zope.schema.IText) 116 116 117 .. method:: provides(waeup. interfaces.ISchemaTypeConverter)117 .. method:: provides(waeup.sirp.interfaces.ISchemaTypeConverter) 118 118 119 119 .. method:: fromString(string[, strict=True]) … … 154 154 .. method:: adapts(zope.schema.IBool) 155 155 156 .. method:: provides(waeup. interfaces.ISchemaTypeConverter)156 .. method:: provides(waeup.sirp.interfaces.ISchemaTypeConverter) 157 157 158 158 .. method:: fromString(string[, strict=True]) … … 195 195 .. method:: adapts(zope.schema.IInt) 196 196 197 .. method:: provides(waeup. interfaces.ISchemaTypeConverter)197 .. method:: provides(waeup.sirp.interfaces.ISchemaTypeConverter) 198 198 199 199 .. method:: fromString(string[, strict=True]) … … 236 236 .. method:: adapts(zope.schema.IChoice) 237 237 238 .. method:: provides(waeup. interfaces.ISchemaTypeConverter)238 .. method:: provides(waeup.sirp.interfaces.ISchemaTypeConverter) 239 239 240 240 .. method:: fromString(string[, strict=False]) … … 290 290 :class:`TextConverter` instance: 291 291 292 >>> from waeup. utils.converters import TextConverter292 >>> from waeup.sirp.utils.converters import TextConverter 293 293 >>> converter = TextConverter(field) 294 294 295 295 Or we can just grab a registered adapter: 296 296 297 >>> from waeup. interfaces import ISchemaTypeConverter297 >>> from waeup.sirp.interfaces import ISchemaTypeConverter 298 298 >>> converter = ISchemaTypeConverter(field) 299 299 … … 301 301 302 302 >>> converter 303 <waeup. utils.converters.TextConverter object at 0x...>303 <waeup.sirp.utils.converters.TextConverter object at 0x...> 304 304 305 305 Now we can convert strings to this type: … … 378 378 :class:`BoolConverter` instance: 379 379 380 >>> from waeup. utils.converters import BoolConverter380 >>> from waeup.sirp.utils.converters import BoolConverter 381 381 >>> converter = BoolConverter(field) 382 382 383 383 Or we can just grab a registered adapter: 384 384 385 >>> from waeup. interfaces import ISchemaTypeConverter385 >>> from waeup.sirp.interfaces import ISchemaTypeConverter 386 386 >>> converter = ISchemaTypeConverter(field) 387 387 … … 389 389 390 390 >>> converter 391 <waeup. utils.converters.BoolConverter object at 0x...>391 <waeup.sirp.utils.converters.BoolConverter object at 0x...> 392 392 393 393 Now we can convert strings to this type: … … 490 490 :class:`IntConverter` instance: 491 491 492 >>> from waeup. utils.converters import IntConverter492 >>> from waeup.sirp.utils.converters import IntConverter 493 493 >>> converter = IntConverter(field) 494 494 495 495 Or we can just grab a registered adapter: 496 496 497 >>> from waeup. interfaces import ISchemaTypeConverter497 >>> from waeup.sirp.interfaces import ISchemaTypeConverter 498 498 >>> converter = ISchemaTypeConverter(field) 499 499 … … 501 501 502 502 >>> converter 503 <waeup. utils.converters.IntConverter object at 0x...>503 <waeup.sirp.utils.converters.IntConverter object at 0x...> 504 504 505 505 Now we can convert strings to this type: … … 593 593 :class:`ChoiceConverter` instance: 594 594 595 >>> from waeup. utils.converters import ChoiceConverter595 >>> from waeup.sirp.utils.converters import ChoiceConverter 596 596 >>> converter = ChoiceConverter(field) 597 597 598 598 Or we can just grab a registered adapter: 599 599 600 >>> from waeup. interfaces import ISchemaTypeConverter600 >>> from waeup.sirp.interfaces import ISchemaTypeConverter 601 601 >>> converter = ISchemaTypeConverter(field) 602 602 … … 604 604 605 605 >>> converter 606 <waeup. utils.converters.ChoiceConverter object at 0x...>606 <waeup.sirp.utils.converters.ChoiceConverter object at 0x...> 607 607 608 608 Now we can convert strings to this type: … … 668 668 '1' 669 669 670 >>> from waeup. interfaces import ICourse670 >>> from waeup.sirp.interfaces import ICourse 671 671 >>> from zope.schema import getFields 672 672 >>> field = getFields(ICourse)['semester'] … … 720 720 721 721 We get a converter for this field in the usual way. The 722 :meth:`waeup. utils.converters.fromString()` method will return one of722 :meth:`waeup.sirp.utils.converters.fromString()` method will return one of 723 723 the objects if we feed it with ``'Wilma'`` or ``'Fred'``: 724 724 -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/csvimport.py
r4789 r4920 2 2 """ 3 3 import grok 4 from waeup. csvfile import CSVFile, toBool5 from waeup. csvfile.interfaces import ICSVFile6 from waeup. interfaces import IFacultyContainer, IWAeUPCSVImporter7 from waeup. utils.importexport import CSVImporter4 from waeup.sirp.csvfile import CSVFile, toBool 5 from waeup.sirp.csvfile.interfaces import ICSVFile 6 from waeup.sirp.interfaces import IFacultyContainer, IWAeUPCSVImporter 7 from waeup.sirp.utils.importexport import CSVImporter 8 8 from zope.app.catalog.interfaces import ICatalog 9 9 from zope.component import createObject, getUtility -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/csvimport.txt
r4789 r4920 1 :mod:`waeup. utils.csvimport` -- CSV file importers2 ************************************************** 1 :mod:`waeup.sirp.utils.csvimport` -- CSV file importers 2 ******************************************************* 3 3 4 .. module:: waeup. utils.csvimport4 .. module:: waeup.sirp.utils.csvimport 5 5 6 6 Components for importing CSV files. … … 21 21 data afterwards: 22 22 23 >>> from waeup. university.facultycontainer import FacultyContainer23 >>> from waeup.sirp.university.facultycontainer import FacultyContainer 24 24 >>> mycontainer = FacultyContainer() 25 25 … … 35 35 We get a suitable importer by asking for a multi-adapter to 36 36 our file and IWAeUPCSVExporter (see section above, the importexport 37 module and the `waeup. csvfile` README for details):37 module and the `waeup.sirp.csvfile` README for details): 38 38 39 >>> from waeup. csvfile import getCSVFile40 >>> from waeup. interfaces import IWAeUPCSVImporter39 >>> from waeup.sirp.csvfile import getCSVFile 40 >>> from waeup.sirp.interfaces import IWAeUPCSVImporter 41 41 >>> from zope.component import getMultiAdapter 42 42 >>> importer = getMultiAdapter((getCSVFile('myfaculties.csv'), … … 44 44 ... IWAeUPCSVImporter) 45 45 >>> importer 46 <waeup. utils.csvimport.FacultyCSVImporter object at 0x...>46 <waeup.sirp.utils.csvimport.FacultyCSVImporter object at 0x...> 47 47 48 48 This importer complies with the IWAeUPCSVImporter interface: 49 49 50 >>> from waeup. utils.csvimport import FacultyCSVImporter50 >>> from waeup.sirp.utils.csvimport import FacultyCSVImporter 51 51 >>> IWAeUPCSVImporter.implementedBy(FacultyCSVImporter) 52 52 True -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/helpers.txt
r4789 r4920 1 :mod:`waeup. utils.helpers` -- Helpers for the WAeUP SRP2 ******************************************************* 3 4 .. module:: waeup. utils.helpers1 :mod:`waeup.sirp.utils.helpers` -- Helpers for the WAeUP SRP 2 ************************************************************ 3 4 .. module:: waeup.sirp.utils.helpers 5 5 6 6 Helper functions for the WAeUP SRP. … … 16 16 17 17 >>> import os 18 >>> from waeup. utils.helpers import removeFileOrDirectory18 >>> from waeup.sirp.utils.helpers import removeFileOrDirectory 19 19 >>> open('blah', 'wb').write('nonsense') 20 20 >>> 'blah' in os.listdir('.') … … 67 67 >>> open(os.path.join('src', 'blah'), 'wb').write('nonsense') 68 68 69 >>> from waeup. utils.helpers import copyFileSystemTree69 >>> from waeup.sirp.utils.helpers import copyFileSystemTree 70 70 >>> result = copyFileSystemTree('src', 'dst') 71 71 … … 172 172 returned with all preceeding/following stuff stripped: 173 173 174 >>> from waeup. utils.helpers import getInnerHTMLPart174 >>> from waeup.sirp.utils.helpers import getInnerHTMLPart 175 175 >>> print getInnerHTMLPart("""<html> 176 176 ... <head> -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/importexport.py
r4789 r4920 7 7 from xml.dom.minidom import Document, getDOMImplementation 8 8 from zope.interface import Interface 9 from waeup. csvfile.interfaces import ICSVFile10 from waeup. interfaces import (IWAeUPObject, IWAeUPExporter, IWAeUPXMLExporter,9 from waeup.sirp.csvfile.interfaces import ICSVFile 10 from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPExporter, IWAeUPXMLExporter, 11 11 IWAeUPXMLImporter, IWAeUPCSVImporter) 12 12 -
waeup/branches/ulif-namespace/src/waeup/sirp/utils/importexport.txt
r4789 r4920 33 33 We can export faculties. First we create a faculty:: 34 34 35 >>> from waeup. university.faculty import Faculty35 >>> from waeup.sirp.university.faculty import Faculty 36 36 >>> myfaculty = Faculty() 37 37 >>> myfaculty.name = 'My very faculty.' … … 43 43 an exporter:: 44 44 45 >>> from waeup. interfaces import IWAeUPXMLExporter45 >>> from waeup.sirp.interfaces import IWAeUPXMLExporter 46 46 >>> exporter = IWAeUPXMLExporter(myfaculty) 47 47 >>> exporter 48 <waeup. utils.importexport.XMLExporter object at 0x...>48 <waeup.sirp.utils.importexport.XMLExporter object at 0x...> 49 49 50 50 All exporters provide an ``export(<obj>)`` method:: … … 85 85 afterwards:: 86 86 87 >>> from waeup. university.faculty import Faculty87 >>> from waeup.sirp.university.faculty import Faculty 88 88 >>> myfaculty = Faculty() 89 89 >>> myfaculty.name = 'My very faculty.' … … 91 91 We create an XML dump of this object:: 92 92 93 >>> from waeup. interfaces import IWAeUPXMLExporter93 >>> from waeup.sirp.interfaces import IWAeUPXMLExporter 94 94 >>> exporter = IWAeUPXMLExporter(myfaculty) 95 95 >>> result = exporter.export('myexport.xml') … … 101 101 Now we create an importer for that file:: 102 102 103 >>> from waeup. interfaces import IWAeUPXMLImporter103 >>> from waeup.sirp.interfaces import IWAeUPXMLImporter 104 104 >>> importer = IWAeUPXMLImporter(myfaculty) 105 105 … … 114 114 115 115 >>> new_obj 116 <waeup. university.faculty.Faculty object at 0x...>116 <waeup.sirp.university.faculty.Faculty object at 0x...> 117 117 118 118 >>> new_obj.name … … 135 135 136 136 >>> new_obj 137 <waeup. university.faculty.Faculty object at 0x...>137 <waeup.sirp.university.faculty.Faculty object at 0x...> 138 138 139 139 Clean up:: … … 158 158 159 159 CSV sources build a plugin framework inside the WAeUP portal (that 160 might be factored out one day). See `waeup. csvfile` to learn more160 might be factored out one day). See `waeup.sirp.csvfile` to learn more 161 161 about that. 162 162 163 A `waeup. csvfile.CSVFile` plugin cares for a special kind of CSV file.163 A `waeup.sirp.csvfile.CSVFile` plugin cares for a special kind of CSV file. 164 164 165 165 To make clear what that means, we start by creating a simple CSV … … 186 186 a file: 187 187 188 >>> from waeup. csvfile import getCSVFile188 >>> from waeup.sirp.csvfile import getCSVFile 189 189 >>> mysource = getCSVFile('mycavedata.csv') 190 190 >>> mysource 191 <waeup. csvfile.csvfile.CSVFile object at 0x...>191 <waeup.sirp.csvfile.csvfile.CSVFile object at 0x...> 192 192 193 193 We define caves like this: … … 218 218 importer, that imports data to the container: 219 219 220 >>> from waeup. csvfile.interfaces import ICSVFile221 >>> from waeup. utils.importexport import CSVImporter222 >>> from waeup. interfaces import IWAeUPCSVImporter220 >>> from waeup.sirp.csvfile.interfaces import ICSVFile 221 >>> from waeup.sirp.utils.importexport import CSVImporter 222 >>> from waeup.sirp.interfaces import IWAeUPCSVImporter 223 223 >>> class CaveImporter(CSVImporter): 224 224 ... # Tell, what kinds of objects we connect... … … 268 268 adapting this instead of ICSVData. 269 269 270 In the `waeup. csvfile` subpackage's README it is shown, how this can270 In the `waeup.sirp.csvfile` subpackage's README it is shown, how this can 271 271 be accomplished. 272 272 -
waeup/branches/ulif-namespace/src/waeup/sirp/widgets/table.py
r4789 r4920 4 4 from hurry import yui 5 5 from zope.interface import Interface 6 from waeup. widgets.interfaces import ITableProvider6 from waeup.sirp.widgets.interfaces import ITableProvider 7 7 8 8 def varName(string): -
waeup/branches/ulif-namespace/src/waeup/sirp/widgets/table.txt
r4789 r4920 1 waeup. widgets2 ************* 1 waeup.sirp.widgets 2 ****************** 3 3 4 4 Widgets for the WAeUP SRP. … … 10 10 ====== 11 11 12 >>> from waeup. widgets.table import Col, Table12 >>> from waeup.sirp.widgets.table import Col, Table 13 13 >>> id = Col( 14 14 ... header='Id', width=100, sortable=True, type='int', … … 45 45 46 46 47 >>> from waeup. widgets.table import YUITable47 >>> from waeup.sirp.widgets.table import YUITable 48 48 >>> table = YUITable('My YUI Table', cols=(id, mycol1, mycol2)) 49 49 >>> print table.getJSTableCode() … … 75 75 of object. The YUIStaticTableView looks up such an adapter for a given 76 76 context to find a table to manage. The adapter has to implement 77 `ITableProvider` from `waeup. widgets.interfaces` and should provide a77 `ITableProvider` from `waeup.sirp.widgets.interfaces` and should provide a 78 78 `getTables` method. 79 79 … … 82 82 >>> import grok 83 83 >>> grok.testing.grok('waeup') 84 >>> from waeup. widgets.interfaces import ITableProvider84 >>> from waeup.sirp.widgets.interfaces import ITableProvider 85 85 >>> class TableAdapter(grok.Adapter): 86 86 ... grok.context(SomeContent) … … 102 102 ... name='yuistatictables.js') 103 103 >>> view 104 <waeup. widgets.table.YUIStaticTableView object at 0x...>104 <waeup.sirp.widgets.table.YUIStaticTableView object at 0x...> 105 105 106 106 When we call the view we get pure JavaScript: … … 126 126 ... name='yuistatictables.js') 127 127 >>> view 128 <waeup. widgets.table.YUIStaticTableView object at 0x...>128 <waeup.sirp.widgets.table.YUIStaticTableView object at 0x...> 129 129 130 130 But if we call this adapter, we will get an empty result, because -
waeup/branches/ulif-namespace/src/waeup/sirp/workflow.py
r4789 r4920 7 7 from hurry.workflow.interfaces import IWorkflow, IWorkflowState, IWorkflowInfo 8 8 from hurry.workflow.interfaces import IWorkflowVersions 9 from waeup. interfaces import IWAeUPObject9 from waeup.sirp.interfaces import IWAeUPObject 10 10 11 11 UNCHECKED = 'unchecked'
Note: See TracChangeset for help on using the changeset viewer.