示例#1
0
def cancel_user_task(task_id):
    task = get_task_or_404(task_id)

    cancel_task(task, current_user)
    session.session.commit()

    flash('Aufgabe erfolgreich abgebrochen.', 'success')
    return redirect_or_404(request.args.get("redirect"))
示例#2
0
    def test_task_cancel(self):
        cancel_task(self.task, self.admin)
        self.session.commit()

        assert self.user.room == self.old_room
        assert self.task.status == TaskStatus.CANCELLED
        assert len(logs := self.task.log_entries) == 1
        assert logs[0].author == self.admin
示例#3
0
def cancel_user_task(task_id):
    redirect_url = request.args.get("redirect")

    task = Task.q.get(task_id)

    if task is None:
        abort(404)

    cancel_task(task, current_user)

    session.session.commit()

    flash(u'Aufgabe erfolgreich abgebrochen.', 'success')

    if redirect_url:
        return redirect(redirect_url)
    else:
        return abort(404)  # redirect(url_for('.tasks'))
示例#4
0
文件: __init__.py 项目: agdsn/pycroft
    def delete(self, user_id):
        """
        Cancel termination of a membership

        :param user_id: The ID of the user
        :return:
        """

        user = get_user_or_404(user_id)

        task = membership_ending_task(user)

        if task is None:
            abort(400, message="There is no termination scheduled")

        if not user.has_property('member'):
            abort(400, message="User is not a member.")

        cancel_task(task, user)

        session.session.commit()

        return "Membership termination cancelled."