added option of specifying if previous mentors and comments must be removed in publish task event.
--- a/taskapp/events/task.py Fri Feb 26 11:29:25 2010 +0530
+++ b/taskapp/events/task.py Fri Feb 26 11:34:17 2010 +0530
@@ -2,7 +2,7 @@
from pytask.taskapp.models import Profile, Task, Comment, Credit, Claim, Map
from pytask.taskapp.utilities.request import create_request
-def publishTask(task):
+def publishTask(task, rem_mentors=True, rem_comments=True):
""" set the task status to open """
if task.sub_type == 'D':
@@ -15,11 +15,13 @@
else:
task.status = "OP"
- task.mentors.clear()
- task.mentors.add(task.created_by)
+ if rem_mentors:
+ task.mentors.clear()
+ task.mentors.add(task.created_by)
- task.comment_set.update(is_deleted=True)
- task.comment_set.update(deleted_by=task.created_by)
+ if rem_comments:
+ task.comment_set.update(is_deleted=True)
+ task.comment_set.update(deleted_by=task.created_by)
task.save()
return task