Commit b0f5aa77 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added a comment for getModificationDate. Added initial support for asContent...

Added a comment for getModificationDate. Added initial support for asContent for objects which __init__ method does not have an id parameter, such as tools. Added missing spaces.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14384 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2f0f48bc
...@@ -2104,7 +2104,14 @@ class Base( CopyContainer, ...@@ -2104,7 +2104,14 @@ class Base( CopyContainer,
def asContext(self, context=None, REQUEST=None, **kw): def asContext(self, context=None, REQUEST=None, **kw):
if context is None: if context is None:
# Make a copy # Make a copy
context = self.__class__(self.getId()) klass = self.__class__
if getattr(klass, 'id', None):
# If id is defined on the class, it is usually
# the sign that this is a tool and that
# __init__ takes no id parameter
context = klass()
else:
context = klass(self.getId())
context.__dict__.update(self.__dict__) context.__dict__.update(self.__dict__)
# Copy REQUEST properties to self # Copy REQUEST properties to self
if REQUEST is not None: if REQUEST is not None:
...@@ -2518,6 +2525,9 @@ class Base( CopyContainer, ...@@ -2518,6 +2525,9 @@ class Base( CopyContainer,
def getModificationDate(self): def getModificationDate(self):
""" """
Returns the modification date of the document based on workflow information Returns the modification date of the document based on workflow information
NOTE: this method is not generic enough. Suggestion: define a modification_date
variable on the workflow which is an alias to time.
""" """
# Check if edit_workflow defined # Check if edit_workflow defined
portal_workflow = getToolByName(self, 'portal_workflow') portal_workflow = getToolByName(self, 'portal_workflow')
...@@ -2953,7 +2963,7 @@ class TempBase(Base): ...@@ -2953,7 +2963,7 @@ class TempBase(Base):
""" """
Returns the title of this document Returns the title of this document
""" """
return getattr(self,'title',None) return getattr(self, 'title', None)
security.declarePublic('setProperty') security.declarePublic('setProperty')
......
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