Commit 6b0dd6c5 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add an optional parameter keep into manageClearActivities.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4882 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8d52d6a9
...@@ -685,7 +685,7 @@ class ActivityTool (Folder, UniqueObject): ...@@ -685,7 +685,7 @@ class ActivityTool (Folder, UniqueObject):
return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivities')) return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivities'))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageClearActivities' ) security.declareProtected( CMFCorePermissions.ManagePortal, 'manageClearActivities' )
def manageClearActivities(self, REQUEST=None): def manageClearActivities(self, keep=1, REQUEST=None):
""" """
Clear all activities and recreate tables. Clear all activities and recreate tables.
""" """
...@@ -693,14 +693,15 @@ class ActivityTool (Folder, UniqueObject): ...@@ -693,14 +693,15 @@ class ActivityTool (Folder, UniqueObject):
# Obtain all pending messages. # Obtain all pending messages.
message_list = [] message_list = []
for activity in activity_list: if keep:
if hasattr(activity, 'dumpMessageList'): for activity in activity_list:
try: if hasattr(activity, 'dumpMessageList'):
message_list.extend(activity.dumpMessageList(self)) try:
except ConflictError: message_list.extend(activity.dumpMessageList(self))
raise except ConflictError:
except: raise
LOG('ActivityTool', WARNING, 'could not dump messages from %s' % (activity,), error=sys.exc_info()) except:
LOG('ActivityTool', WARNING, 'could not dump messages from %s' % (activity,), error=sys.exc_info())
if hasattr(folder, 'SQLDict_createMessageTable'): if hasattr(folder, 'SQLDict_createMessageTable'):
try: try:
......
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