Commit 9c95618d authored by Jérome Perrin's avatar Jérome Perrin

Enable History tab and ZMI comparision
add utility methods



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10437 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 87d40636
......@@ -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 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, prop_holder):
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
......@@ -416,6 +421,14 @@ class Base( CopyContainer, PortalContent, ActiveObject, Historical, ERP5Property
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
......@@ -540,6 +553,14 @@ class Base( CopyContainer, PortalContent, ActiveObject, Historical, ERP5Property
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):
return aq_inner(self.getPortalObject().portal_categories)
......
......@@ -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 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
security.declareObjectProtected(Permissions.AccessContentsInformation)
manage_options = ( CMFBTreeFolder.manage_options +
Historical.manage_options +
CMFCatalogAware.manage_options
)
# Declarative properties
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment