[Zope-CVS] CVS: Products/ZopeVersionControl - Repository.py:1.11
Ken Manheimer
klm at zope.com
Tue Feb 24 13:32:54 EST 2004
Update of /cvs-repository/Products/ZopeVersionControl
In directory cvs.zope.org:/tmp/cvs-serv13474
Modified Files:
Repository.py
Log Message:
Make __non_versionable__ the canonical and sole attribute used for
exempting an object from versioning. Also, export a function named
'isAVersionableResource' for use in VersionSupport, so we use the
exact same function there and in the Repository class.
This reconciliation will rectify the test i changed which expects
__non_versionable__ to be the exemption.
=== Products/ZopeVersionControl/Repository.py 1.10 => 1.11 ===
--- Products/ZopeVersionControl/Repository.py:1.10 Fri Jan 30 13:59:39 2004
+++ Products/ZopeVersionControl/Repository.py Tue Feb 24 13:32:54 2004
@@ -30,6 +30,16 @@
from nonversioned import getNonVersionedData, restoreNonVersionedData
+def isAVersionableResource(obj):
+ """ True if an object is versionable.
+
+ To qualify, the object must be persistent (have its own db record), and
+ must not have an true attribute named '__non_versionable__'."""
+
+ if getattr(obj, '__non_versionable__', 0):
+ return 0
+ return hasattr(obj, '_p_oid')
+
class Repository(Implicit, Persistent):
"""The repository implementation manages the actual data of versions
and version histories. It does not handle user interface issues."""
@@ -95,9 +105,7 @@
def isAVersionableResource(self, obj):
# For now, an object must be persistent (have its own db record)
# in order to be considered a versionable resource.
- if not getattr(obj, '_versionable', 1):
- return 0
- return hasattr(obj, '_p_oid')
+ return isAVersionableResource(obj)
security.declarePublic('isUnderVersionControl')
def isUnderVersionControl(self, object):
More information about the Zope-CVS
mailing list