[Zope-CVS] SVN: zversioning/trunk/src/versioning/ changes in the interfaces plus divers small changes

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


Log message for revision 28119:
  changes in the interfaces plus divers small changes

Changed:
  U   zversioning/trunk/src/versioning/README.txt
  U   zversioning/trunk/src/versioning/interfaces.py
  U   zversioning/trunk/src/versioning/repository.py

-=-
Modified: zversioning/trunk/src/versioning/README.txt
===================================================================
--- zversioning/trunk/src/versioning/README.txt	2004-10-13 17:29:34 UTC (rev 28118)
+++ zversioning/trunk/src/versioning/README.txt	2004-10-13 17:30:58 UTC (rev 28119)
@@ -57,6 +57,7 @@
   ...                      storage.SimpleHistoryStorage())
   
   >>> histories_storage = zapi.getUtility(interfaces.IHistoryStorage)
+  >>> db_root['storage'] = histories_storage
 
 We also need a 'IVersionableAspects' multi adapter beeing responsible
 for the versioning policy (what is versioned and how (not storage)).

Modified: zversioning/trunk/src/versioning/interfaces.py
===================================================================
--- zversioning/trunk/src/versioning/interfaces.py	2004-10-13 17:29:34 UTC (rev 28118)
+++ zversioning/trunk/src/versioning/interfaces.py	2004-10-13 17:30:58 UTC (rev 28119)
@@ -46,12 +46,10 @@
 class IRepository(Interface):
     """A version repository providing core functionality.
     
-    IRepository is a kind of abstract component as the most important
+    IRepository describes an abstract component as the most important
     functionality of storing versions of object is not implemented
     here.
     
-    See other repository interfaces defining different access strategies.
-
     As long you have at least one object from your versioned
     object cloud you can reach every object from it (at least the 
     versioned aspects). XXX After having deleted the last object 
@@ -70,35 +68,26 @@
     def applyVersionControl(obj):
         """Put the an object under version control.
         
-        This method has to be call prior using any other repository
-        related methods. The objects current state gets saved as first
-        version.
-        
-        XXX Different comments apply for different repositories. Where
-        to put this?
+        This method has to be called prior any of the other repository
+        related methods is used. The objects current state gets saved 
+        as first version.
         """
     
     def revertToVersion(obj, selector):
-        """Reverts the object to the selected version.
-        
-        XXX Do we need to say something about branches?
+        """Reverts the object to the state of a selected version.
         """
         
 
 class ICopyModifyMergeRepository(IRepository):
     """Top level API for a copy-modify-merge (subversion like) repository.
-    """
     
-    def applyVersionControl(obj):
-        """Put the an object under version control.
-        
-        This method has to be call prior using any other repository
-        related methods. The objects current state gets saved as first
-        version.
-        
-        After this operation the object is in checked in state.
-        """
+    This kind of repositories do not support any information about
+    the fact if a object is in use or not.
     
+    XXX Do we have to say something about if a repository has to 
+    support more than one workplace?
+    """
+    
     def saveAsVersion(obj, metadata=None):
         """Save the current state of the object for later retreival.
         """
@@ -107,27 +96,27 @@
     """Top level API for a checkout-modify-checkin (XXX DeltaV like) repository.
     
     These kind of repositories administrate an "object is in use" 
-    information which may be suitable in some environments.
+    information which may be suitable in some environments. 
     
-    The Checkin/Checkout information may be seen as kind of soft lock.
+    The Checkout/Checkin information may also be seen as kind of soft 
+    lock/unlock.
     """
 
+    def applyVersionControl(obj):
+        """Put the an object under version control.
+        
+        For general Aspects see 'IRepository'.
+        After this operation the object is in checked in state.
+        """
+    
     def checkout(obj):
-        """Marks the object as checked out (being in use/soft locked).
+        """Mark the object as checked out.
+        
+        Raises a RepositoryError if the object is already checked out.
         """
     
     def checkin(obj, metadata=None):
-        """Check in the current state of an object and does a soft 
-           unlock.
-        
-        Raises an RepositoryError if the object is not versionable.
-        XXX Other exceptions (for repository problems)?
-        
-        XXX What happens if the follwoing happens:
-            - user A checks out the object
-            - user B checks it out at another location
-            - user B checks in the object
-            - Question: is the object marked as checked in or checked out?
+        """Check in the current state of an object.
         """
 
     def isCheckedOut(obj):
@@ -149,57 +138,28 @@
     """Additional methods providing more information versioned objects.
     """
 
-    def getVersion(obj, selector): # XXX Naming: getCopyOfVersion
+    def getObject(obj, selector):
         """Returns the selected version of an object. 
         
-        This method does not overwrite 'obj' (like revertToVersion
-        does). Instead it returns the version as new object.
+        This method does not overwrite 'obj' (like 'revertToVersion'
+        does).
+        XXX How exactly? Instead it returns the version as new object.
         """
+    
+    def getHistory(obj):
+        """Returns the history of the selected object
+        """
 
+
+    # These are YAGNI
     def getVersionHistory(obj):
         """Returns all versions of the given object.
-        
-        XXX YAGNI? This was the former 'getVersionIds'.
         """
-
-    def listMetadata(obj):
+    def getMetadataHistory(obj):
         """Returns the metadata of all versions of the given object.
         """
 
-class IDeletableRepository(Interface) :
-    """ Most versioning systems do not allow to throw away versioned
-    data, but there might be use cases were simple file repositories
-    or other storage solutions can sweep out old versions. """
 
-    def delete(obj) :
-        """ Forces the repository to remove the version described by the ticket.
-        
-            Raises a VersionUndeletable error if the repository does not
-            allow deletions or something other went wrong.
-        """
-
-
-class ICheckoutAware(Interface):
-    """Marking objects as checked in or checked out.
-    
-    XXX Naming conventions? Aren't IBlahAware interfaces usually marker 
-    interfaces?
-    XXX IUsageTrackingAware?, IInUseMarkingAware, ISoftLockingAware
-    """
-    
-    def markAsCheckedIn(obj):
-        """Marks the object as being checked in.
-        """
-        
-    def markAsCheckedOut(obj):
-        """Marks the object as being checked out.
-        """
-
-    def isCheckedOut(obj):
-        """Returns true if the object is checked out
-        """
-
-   
 class IVersionableAspects(Interface) :
     """ An interface that implements a versioning policy for
         a content type and a storage that knows how to version the
@@ -236,6 +196,27 @@
         XXX copy or ref?
         """
 
+class ICheckoutAware(Interface):
+    """Marking objects as checked in or checked out.
+    
+    XXX Naming conventions? Aren't IBlahAware interfaces usually marker 
+    interfaces?
+    XXX IUsageTrackingAware?, IInUseMarkingAware, ISoftLockingAware
+    """
+    
+    def markAsCheckedIn(obj):
+        """Marks the object as being checked in.
+        """
+        
+    def markAsCheckedOut(obj):
+        """Marks the object as being checked out.
+        """
+
+    def isCheckedOut(obj):
+        """Returns true if the object is checked out
+        """
+
+   
 class ITicket(Interface) :
     """ A marker interface for access information for versioned data.
     
@@ -247,25 +228,11 @@
       
     """
 
-class IVersionHistory(Interface) :
-    """ A version history of a single object. We choose an interface
-        that is provided by any zope folder or container, but can
-        also be easily adapted by any other sequence of objects.
+class IVersionHistory(INameChooser) :
+    """ A version history of a single object should be able to
+        generate unique names for each version within the version history.
     """
     
-    def keys() :
-        """ Returns a sequence of unique ids that can be used as access
-            keys. 
-        """
-    
-    def values() :
-        """ Returns a sequence of versioned objects.
-        """
-        
-    def __getitem__(key) :
-        """ Returns the version that is specified by the key. """
-  
-    
 
 class IHistoryStorage(Interface) : # IHistoriesStorage?
     """ Minimal interface for a pluggable storage that stores a new version

Modified: zversioning/trunk/src/versioning/repository.py
===================================================================
--- zversioning/trunk/src/versioning/repository.py	2004-10-13 17:29:34 UTC (rev 28118)
+++ zversioning/trunk/src/versioning/repository.py	2004-10-13 17:30:58 UTC (rev 28119)
@@ -124,6 +124,9 @@
             (obj, self.histories), interfaces.IVersionableAspects)
         versionable_state.updateAspects(specifier)
         
+    def getVersion(self, obj, selector):
+        return self.histories.getVersion(obj, selector)
+        
     def getVersionHistory(self, obj):
         return self.histories.getVersionHistory(obj)
         



More information about the Zope-CVS mailing list