diff --git a/storage/pzope/README.txt b/storage/pzope/README.txt index 1e63a54..1bd974f 100644 --- a/storage/pzope/README.txt +++ b/storage/pzope/README.txt @@ -7,10 +7,14 @@ Zope-based Object Storage >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown >>> site = placefulSetUp(True) +As the Zope-based storage keeps track of the objects using unique ids +we need a utility that provides these. For testing we use a dummy +implementation; the real stuff is in zope.app.intids and there must +be a corresponding utility in the root site folder of your Zope. + >>> from zope import component - >>> from zope.app.intid.interfaces import IIntIds >>> from cybertools.relation.tests import IntIdsStub - >>> component.provideUtility(IntIdsStub(), IIntIds) + >>> component.provideUtility(IntIdsStub()) We first need a class from which we will create objects that later on will be stored in and retrieved from the storage. @@ -31,13 +35,14 @@ from the corresponding factory in the `manager` module and calling >>> from cybertools.storage.pzope.manager import storages >>> persistent = storages(c1) - >>> uid = persistent.save('c1') + >>> c1Uid = persistent.save('c1') For loading an object we get a storage adapter to the object's class and -call `load()` on it. +call `load()` on it, providing the UID we had got back when saving the +object. >>> persistent = storages(Content) - >>> c2 = persistent.load(uid) + >>> c2 = persistent.load(c1Uid) >>> c2.title 'changed'