[Erp5-report] r10437 - in /erp5/trunk/products/ERP5Type: Base.py Document/Folder.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Sep 30 20:05:36 CEST 2006


Author: jerome
Date: Sat Sep 30 20:05:32 2006
New Revision: 10437

URL: http://svn.erp5.org?rev=10437&view=rev
Log:

Enable History tab and ZMI comparision
add utility methods


Modified:
    erp5/trunk/products/ERP5Type/Base.py
    erp5/trunk/products/ERP5Type/Document/Folder.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=10437&r1=10436&r2=10437&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Sat Sep 30 20:05:32 2006
@@ -26,14 +26,15 @@
 #
 ##############################################################################
 
+from struct import unpack
 import warnings
 import ExtensionClass
+
 from Globals import InitializeClass, DTMLFile, PersistentMapping
 from AccessControl import ClassSecurityInfo
 from AccessControl.Permission import pname, Permission
 from Acquisition import aq_base, aq_inner, aq_acquire, aq_chain
-
-from OFS.History import Historical
+import OFS.History
 
 from Products.CMFCore.PortalContent import PortalContent
 from Products.CMFCore.Expression import Expression
@@ -330,7 +331,11 @@
                     method = WorkflowMethod(method, method_id)
                     setattr(prop_holder, method_id, method)
 
-class Base( CopyContainer, PortalContent, ActiveObject, Historical, ERP5PropertyManager ):
+class Base( CopyContainer,
+            PortalContent,
+            ActiveObject,
+            OFS.History.Historical,
+            ERP5PropertyManager ):
   """
     This is the base class for all ERP5 Zope objects.
     It defines object attributes which are necessary to implement
@@ -415,6 +420,14 @@
       return getattr(Base.aq_portal_type[ptype], id, None).__of__(self)
 
     return None
+  
+  def manage_historyCompare(self, rev1, rev2, REQUEST,
+                            historyComparisonResults=''):
+    return Base.inheritedAttribute('manage_historyCompare')(
+          self, rev1, rev2, REQUEST,
+          historyComparisonResults=OFS.History.html_diff(
+              pformat(rev1.showDict()),
+              pformat(rev2.showDict())))
 
   def _aq_dynamic(self, id):
     ptype = self.portal_type
@@ -539,6 +552,14 @@
     """
     from ZODB.utils import oid_repr
     return oid_repr(self._p_oid)
+  
+  def getSerial(self):
+    """Return ODB Serial."""
+    return self._p_serial
+  
+  def getHistorySerial(self):
+    """Return ODB Serial, in the same format used for history keys"""
+    return '.'.join([str(x) for x in unpack('>HHHH', self._p_serial)])
 
   # Utils
   def _getCategoryTool(self):

Modified: erp5/trunk/products/ERP5Type/Document/Folder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Document/Folder.py?rev=10437&r1=10436&r2=10437&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Document/Folder.py (original)
+++ erp5/trunk/products/ERP5Type/Document/Folder.py Sat Sep 30 20:05:32 2006
@@ -28,6 +28,7 @@
 
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base, aq_self
+from OFS.History import Historical
 import ExtensionClass
 
 from Products.CMFCore.utils import _getAuthenticatedUser
@@ -293,6 +294,7 @@
   security.declareObjectProtected(Permissions.AccessContentsInformation)
   
   manage_options = ( CMFBTreeFolder.manage_options +
+                     Historical.manage_options +
                      CMFCatalogAware.manage_options
                    )
   # Declarative properties




More information about the Erp5-report mailing list