'Remove Task from subscription filter'

def remove_task_subscription(self, task_id):

    db = current.db
    s3db = current.s3db
    subscription = self.subscription
    rfilter = self.rfilter
    ids = subscription['get_vars'][rfilter].split(',')
    if (task_id in ids):
        ids.remove(task_id)
    if (len(ids) == 0):
        stable = s3db.pr_subscription
        db((stable.id == subscription['id'])).update(deleted=True)
        return True
    else:
        ids = ','.join(ids)
    sfilter = [[rfilter, ids], self.exclude]
    subscription['filters'] = json.dumps(sfilter)
    return self.update_subscription()
