Changeset 4080 for waeup/branches
- Timestamp:
- 25 Apr 2009, 13:36:30 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.txt
r3924 r4080 14 14 >>> mycontainer = FacultyContainer() 15 15 16 Another way to get a faculty container -- without importing the class 17 -- is via utilities. FacultyContainer instances provide the 18 IFacultyContainer interface:: 16 Faculty containers provide `IFacultyContainer`: 19 17 20 18 >>> from waeup.interfaces import IFacultyContainer … … 22 20 True 23 21 24 A lso a factory(-utility) is registered, so that we can ask for a25 faculty container without importing one. To check this, we first have 26 to grok the `waeup` package. This is normally done during startup::22 Another way to get a faculty container -- without importing the class 23 -- is via factories. We registered a factory for faculty containers 24 under the name ``waeup.facultycontainer``:: 27 25 28 26 >>> import grok 29 27 >>> grok.testing.grok('waeup') 30 28 31 Now we can ask for an object providing `IFacultyContainer`::29 Now we can ask for an object by calling the appropriate factory: 32 30 33 >>> from zope.component import getUtility34 >>> getUtility(IFacultyContainer)31 >>> from zope.component import createObject 32 >>> createObject(u'waeup.FacultyContainer') 35 33 <waeup.university.facultycontainer.FacultyContainer object at 0x...> 36 34
Note: See TracChangeset for help on using the changeset viewer.