Changeset 4082 for waeup/branches/ulif-rewrite/src
- Timestamp:
- 25 Apr 2009, 13:45:25 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/hostel/hostelcontainer.txt
r3941 r4082 14 14 >>> mycontainer = HostelContainer() 15 15 16 Another way to get a hostel container -- without importing the class 17 -- is via utilities. HostelContainer instances provide the 18 IHostelContainer interface:: 16 Hostel containers provide ``IHostelContainer``: 19 17 20 18 >>> from waeup.interfaces import IHostelContainer … … 22 20 True 23 21 24 A lso a factory(-utility) is registered, so that we can ask for a25 hostel 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 hostel container -- without importing the class 23 -- is via factories. We registered a factory for hostel containers 24 under the name ``waeup.HostelContainer``:: 27 25 28 26 >>> import grok 29 27 >>> grok.testing.grok('waeup') 30 28 31 Now we can ask for an object providing `IHostelContainer`::29 Now we can ask for an object by calling the appropriate factory: 32 30 33 >>> from zope.component import getUtility34 >>> getUtility(IHostelContainer)31 >>> from zope.component import createObject 32 >>> createObject(u'waeup.HostelContainer') 35 33 <waeup.hostel.hostelcontainer.HostelContainer object at 0x...> 36 34
Note: See TracChangeset for help on using the changeset viewer.