diff options
author | nishanth | 2010-02-26 01:23:17 +0530 |
---|---|---|
committer | nishanth | 2010-02-26 01:23:17 +0530 |
commit | 8ebb266ae705a923bfc081663516a19750c7b31d (patch) | |
tree | b053a360fdef6dddbec28a02be7d94f3eb40680c /taskapp | |
parent | 522fbe3ea31327b893cc95b19bb8d7e66bd0de81 (diff) | |
download | pytask-8ebb266ae705a923bfc081663516a19750c7b31d.tar.gz pytask-8ebb266ae705a923bfc081663516a19750c7b31d.tar.bz2 pytask-8ebb266ae705a923bfc081663516a19750c7b31d.zip |
updated show_msg method to also use the user variable in the context.
Diffstat (limited to 'taskapp')
-rw-r--r-- | taskapp/views/task.py | 30 | ||||
-rw-r--r-- | taskapp/views/user.py | 8 |
2 files changed, 19 insertions, 19 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 1dc2b89..9deab07 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -109,9 +109,9 @@ def create_task(request): form = TaskCreateForm() return render_to_response('task/create.html',{'form':form}) else: - return show_msg('You are not authorised to create a task.') + return show_msg(user, 'You are not authorised to create a task.') else: - return show_msg('You are not authorised to create a task.') + return show_msg(user, 'You are not authorised to create a task.') def add_mentor(request, tid): """ check if the current user has the rights to edit the task and add him. @@ -151,7 +151,7 @@ def add_mentor(request, tid): return render_to_response('task/addmentor.html', {'form':form, 'errors':errors}) else: - return show_msg('You are not authorised to add mentors for this task', task_url, 'view the task') + return show_msg(user, 'You are not authorised to add mentors for this task', task_url, 'view the task') def add_tasks(request, tid): """ first display tasks which can be subtasks for the task and do the rest. @@ -209,9 +209,9 @@ def add_tasks(request, tid): else: errors = ["The task cannot be added subtasks or dependencies in this state"] # return render_to_response('task/add.html', {'form':form, 'errors':errors}) - return show_msg('The task cannot be added subtasks or dependencies now', task_url, 'view the task') + return show_msg(user, 'The task cannot be added subtasks or dependencies now', task_url, 'view the task') else: - return show_msg('You are not authorised to add subtasks or dependencies for this task', task_url, 'view the task') + return show_msg(user, 'You are not authorised to add subtasks or dependencies for this task', task_url, 'view the task') def remove_task(request, tid): """ display a list of tasks and remove the selectes ones. @@ -247,9 +247,9 @@ def remove_task(request, tid): else: return render_to_response('task/removetask.html', {'user':user, 'form':form, 'errors':errors}) else: - return show_msg("The task has no subtasks/dependencies to be removed", task_url, "view the task") + return show_msg(user, "The task has no subtasks/dependencies to be removed", task_url, "view the task") else: - return show_msg("You are not authorised to do this", task_url, "view the task") + return show_msg(user, "You are not authorised to do this", task_url, "view the task") def claim_task(request, tid): @@ -299,7 +299,7 @@ def claim_task(request, tid): else: return render_to_response('task/claim.html', context) else: - return show_msg('You are not logged in to view claims for this task', task_url, 'view the task') + return show_msg(user, 'You are not logged in to view claims for this task', task_url, 'view the task') def rem_user(request, tid): """ show a list of working users and ask for a message/reason for removing user. @@ -341,9 +341,9 @@ def rem_user(request, tid): else: return render_to_response('task/remove_user.html',context) else: - return show_msg("There is no one working on this task to be kicked off", task_url, "view the task") + return show_msg(user, "There is no one working on this task to be kicked off", task_url, "view the task") else: - return show_msg("You are not authorised to do this", task_url, "view the task") + return show_msg(user, "You are not authorised to do this", task_url, "view the task") def assign_task(request, tid): """ first get the status of the task and then assign it to one of claimed users @@ -376,11 +376,11 @@ def assign_task(request, tid): else: return render_to_response('task/assign.html',{'form':form}) elif assigned_users: - return show_msg('When the no of users you need for the task is more than the no of users willing to do the task, I\'d say please re consider the task :P',task_url, 'view the task') + return show_msg(user, 'When the no of users you need for the task is more than the no of users willing to do the task, I\'d say please re consider the task :P',task_url, 'view the task') else: - return show_msg('Wait for ppl to claim dude... slow and steady wins the race :)', task_url, 'view the task') + return show_msg(user, 'Wait for ppl to claim dude... slow and steady wins the race :)', task_url, 'view the task') else: - return show_msg('You are not authorised to perform this action', task_url, 'view the task') + return show_msg(user, 'You are not authorised to perform this action', task_url, 'view the task') def assign_credits(request, tid): """ Check if the user is a mentor and credits can be assigned. @@ -429,9 +429,9 @@ def assign_credits(request, tid): else: return render_to_response('task/assigncredits.html', context) else: - return show_msg("Credits cannot be assigned at this stage", task_url, "view the task") + return show_msg(user, "Credits cannot be assigned at this stage", task_url, "view the task") else: - return show_msg("You are not authorised to perform this action", task_url, "view the task") + return show_msg(user, "You are not authorised to perform this action", task_url, "view the task") def edit_task(request, tid): """ see what are the attributes that can be edited depending on the current status diff --git a/taskapp/views/user.py b/taskapp/views/user.py index 32a54aa..5b3bf17 100644 --- a/taskapp/views/user.py +++ b/taskapp/views/user.py @@ -10,7 +10,7 @@ from pytask.taskapp.events.user import createUser, updateProfile from pytask.taskapp.forms.user import UserProfileEditForm from pytask.taskapp.events.request import reply_to_request -def show_msg(message, redirect_url=None, url_desc=None): +def show_msg(user, message, redirect_url=None, url_desc=None): """ simply redirect to homepage """ return render_to_response('show_msg.html',{'message':message, 'redirect_url':redirect_url, 'url_desc':url_desc}) @@ -153,9 +153,9 @@ def process_request(request, rid, reply): reply_to_request(req_obj, reply, user) - return show_msg("Your reply has been processed", browse_request_url, "view other requests") + return show_msg(user, "Your reply has been processed", browse_request_url, "view other requests") else: - return show_msg("You are not authorised to do this", browse_request_url, "view other requests") + return show_msg(user, "You are not authorised to do this", browse_request_url, "view other requests") @login_required def browse_notifications(request): @@ -215,5 +215,5 @@ def edit_notification(request, nid, action): notification.save() return redirect(notifications_url) else: - return show_msg('This is wrong', notification_url, "view the notification") + return show_msg(user, 'This is wrong', notification_url, "view the notification") |