[Zope-CVS] SVN: zversioning/trunk/src/versioning/README.txt intermediate version

Grégoire Weber zope.org at incept.ch
Wed Oct 13 09:13:06 EDT 2004


Log message for revision 28076:
  intermediate version

Changed:
  U   zversioning/trunk/src/versioning/README.txt

-=-
Modified: zversioning/trunk/src/versioning/README.txt
===================================================================
--- zversioning/trunk/src/versioning/README.txt	2004-10-13 13:09:00 UTC (rev 28075)
+++ zversioning/trunk/src/versioning/README.txt	2004-10-13 13:13:05 UTC (rev 28076)
@@ -41,25 +41,57 @@
   >>> from versioning.tests.repository_setup import buildRepository, buildDatabaseRoot
   >>> db_root = buildDatabaseRoot()
   >>> db_root["sample"] = sample 
-  
+
 In this architecture we can choose between several repositories. We take a
 CopyModifyMergeRepository without check in and check out as an example.
- 
+
+  >>> from zope.app.tests import ztapi
+  >>> from versioning import interfaces, policies, storage
+
+First lets configure the 'IHistoryStorage' utility being responsible
+for the storage of the objects histories:
+
+  >>> ztapi.provideUtility(interfaces.IHistoryStorage,
+  ...                      storage.SimpleHistoryStorage())
+
+Then we need a 'IVersionableAspects' multi adapter beeing responsible
+for the versioning policy (what is versioned and how (not storage)).
+
+  >>> ztapi.provideAdapter((interfaces.IVersionable, 
+  ...                       interfaces.IHistoryStorage),
+  ...                      interfaces.IVersionableAspects,
+  ...                      policies.VersionableAspectsAdapter)
+
   >>> from versioning.repository import CopyModifyMergeRepository
   >>> repository = buildRepository(CopyModifyMergeRepository)
 
+An object that isn't 'IVersionable' can't be put under version control:
+
+  >>> repository.applyVersionControl(a)
+  Traceback (most recent call last):
+  RepositoryError: This resource cannot be put under version control.
+
+  >>> from versioning.tests.repository_setup import instanceProvides
+  >>> instanceProvides(sample, interfaces.IVersionable)
+  >>> instanceProvides(a, interfaces.IVersionable)
+  >>> instanceProvides(b, interfaces.IVersionable)
+  >>> instanceProvides(c, interfaces.IVersionable)
+
+The chosen 'IHistoryStorage' component expects the objects having
+a '_p_oid'
+
+  >>> util.commit()
+
 Now we can put our example data under version control:
 
   >>> repository.applyVersionControl(sample)
   >>> repository.applyVersionControl(a)
   >>> repository.applyVersionControl(b)
   >>> repository.applyVersionControl(c)
-  >>> util.commit()
   >>> [IVersioned.providedBy(x) for x in (sample, a, b, c)]
   [True, True, True, True]
   >>> [x for x in sample.keys()]
   [u'a', u'b']
-  
 
 
   >>> def accessVersion(repository, obj) :



More information about the Zope-CVS mailing list