Commit 6968aae5 authored by Jean-Paul Smets's avatar Jean-Paul Smets

FIrst implementatoin of vorklow based getCreationDate and getModificationDate


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4517 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3583220f
...@@ -2048,7 +2048,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -2048,7 +2048,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
def _temp_getTitle(self): def _temp_getTitle(self):
return getattr(self,'title',None) return getattr(self,'title',None)
def log(self,description,content): def log(self, description, content):
""" """
Put a log message Put a log message
""" """
...@@ -2056,29 +2056,6 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -2056,29 +2056,6 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
security.declareProtected(Permissions.ModifyPortalContent,'setDescription') security.declareProtected(Permissions.ModifyPortalContent,'setDescription')
# Creation and modification date support through workflow
security.declareProtected(Permissions.AccessContentsInformation, 'getCreationDate')
def getCreationDate(self):
"""
Returns the creation date of the document based on workflow information
"""
# XXX To be implemenented
# Check if edit workflow defined
# Return none if not (or get it from parent ?)
# Then get the first line of edit_workflow
return None
security.declareProtected(Permissions.AccessContentsInformation, 'getModificationDate')
def getModificationDate(self):
"""
Returns the modification date of the document based on workflow information
"""
# XXX To be implemenented
# Check if edit workflow defined
# Return none if not (or get it from parent ?)
# Then get the first line of edit_workflow
return None
# Dublin Core Emulation for CMF interoperatibility # Dublin Core Emulation for CMF interoperatibility
# CMF Dublin Core Compatibility # CMF Dublin Core Compatibility
def Title(self): def Title(self):
...@@ -2111,6 +2088,43 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -2111,6 +2088,43 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
def Rights(self): def Rights(self):
return self.getRight('') return self.getRight('')
# Creation and modification date support through workflow
security.declareProtected(Permissions.AccessContentsInformation, 'getCreationDate')
def getCreationDate(self):
"""
Returns the creation date of the document based on workflow information
"""
# Check if edit_workflow defined
portal_workflow = getToolByName(self, 'portal_workflow')
wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None: wf_list = [wf] + wf_list
for wf in portal_workflow.getWorkflowsFor(self):
history = wf.getInfoFor(self, 'history', None)
if history is not None:
if len(history):
# Then get the first line of edit_workflow
return history[0].get('time', None)
return None
security.declareProtected(Permissions.AccessContentsInformation, 'getModificationDate')
def getModificationDate(self):
"""
Returns the modification date of the document based on workflow information
"""
# Check if edit_workflow defined
portal_workflow = getToolByName(self, 'portal_workflow')
wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None: wf_list = [wf] + wf_list
for wf in portal_workflow.getWorkflowsFor(self):
history = wf.getInfoFor(self, 'history', None)
if history is not None:
if len(history):
# Then get the first line of edit_workflow
return history[-1].get('time', None)
return None
InitializeClass(Base) InitializeClass(Base)
class TempBase(Base): class TempBase(Base):
......
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