# HG changeset patch # User nishanth # Date 1267164257 -19800 # Node ID ea962d5fe99e15e704a7e6609a928f870179b36c # Parent eadff01e395efa440e2c13f1a68d4cf7a377fd94 added option of specifying if previous mentors and comments must be removed in publish task event. diff -r eadff01e395e -r ea962d5fe99e taskapp/events/task.py --- 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