[Zope-CVS] CVS: Packages/VersionControl - VersionControl.py:1.3 VersionSupport.py:1.3
Brian Lloyd
brian@digicool.com
Fri, 19 Oct 2001 15:03:24 -0400
Update of /cvs-repository/Packages/VersionControl
In directory cvs.zope.org:/tmp/cvs-serv8780
Modified Files:
VersionControl.py VersionSupport.py
Log Message:
implement quick-hack of read-only protection for version data
=== Packages/VersionControl/VersionControl.py 1.2 => 1.3 ===
# This is a hack and should be changed!
- vobject = Acquisition.aq_base(version.data)
+ vobject = version.getReadOnlyObject()
return vobject
=== Packages/VersionControl/VersionSupport.py 1.2 => 1.3 ===
If version_id is None, get the latest revision."""
vc = VersionControl(self)
- return vc.getVersionOfObject(self, version_id)
+ object = vc.getVersionOfObject(self, version_id)
+ parent = Acquisition.aq_parent(Acquisition.aq_inner(self))
+ return object.__of__(parent)
unVC__roles__ = None
@@ -164,6 +166,26 @@
del self._vc_info
return 'ok'
+# This was only for quick testing...
+
+## def __bobo_traverse__(self, REQUEST, name=None):
+
+## try: return getattr(self, name)
+## except AttributeError: pass
+## try: return self[name]
+## except: pass
+## method=REQUEST.get('REQUEST_METHOD', 'GET')
+## if not method in ('GET', 'POST'):
+## return NullResource(self, name, REQUEST).__of__(self)
+
+## if name[:3] == '(v)':
+## return self.getVersionOfObject(name[3:])
+
+## # Waaa. unrestrictedTraverse calls us with a fake REQUEST.
+## # There is proabably a better fix for this.
+## try: REQUEST.RESPONSE.notFoundError("%s\n%s" % (name, method))
+## except AttributeError:
+## raise KeyError, name
InitializeClass(VersionSupport)