[Zope-Checkins] CVS: Packages/OFS - History.py:1.12

Evan Simpson evan@zope.com
Fri, 15 Feb 2002 12:54:49 -0500


Update of /cvs-repository/Packages/OFS
In directory cvs.zope.org:/tmp/cvs-serv14566/OFS

Modified Files:
	History.py 
Log Message:
Don't raise a TemporalParadox unless something actually changed.

Use difflib instead of ndiff (http://collector.zope.org/Zope/32)


=== Packages/OFS/History.py 1.11 => 1.12 ===
 __version__='$Revision$'[11:-2]
 
-import Globals, ndiff, ExtensionClass
+import Globals, ExtensionClass, difflib
 from DateTime import DateTime
 from Acquisition import Implicit, aq_base
 from struct import pack, unpack
@@ -34,13 +34,14 @@
     def __getattr__(self, name):
         return getattr(self.__base__, name)
 
-    def commit(*args, **kw):
-        raise TemporalParadox, "You can\'t change history!"
-
-    tpc_begin = tpc_finish = commit
+    def commit(self, object, transaction):
+        if object._p_changed:
+            raise TemporalParadox, "You can\'t change history!"
 
     def abort(*args, **kw): pass
 
+    tpc_begin = tpc_finish = abort
+
 def historicalRevision(self, serial):
     state=self._p_jar.oldstate(self, serial)
     rev=self.__class__.__basicnew__()
@@ -227,7 +228,8 @@
     from string import split
     a=s1.split('\n')
     b=s2.split('\n')
-    cruncher=ndiff.SequenceMatcher(isjunk=split, a=a, b=b)
+    cruncher=difflib.SequenceMatcher()
+    cruncher.set_seqs(a,b)
 
     r=['<table border=1>']
     for tag, alo, ahi, blo, bhi in cruncher.get_opcodes():