get_task of project.py has tuple unpacking issue #2147
* This patch removes tuple unpacking of task from get_task, and project from get_project, instead getting values by tuble indexing Task ID: project-7/task-2147 Issue ID: 299006
This commit is contained in:
parent
df2d8f69ce
commit
4f7b590c81
16
project.py
16
project.py
|
@ -462,19 +462,19 @@ class Project:
|
|||
|
||||
:param project_id: Project Id of project to fetch.
|
||||
"""
|
||||
project, = cls.search([
|
||||
projects = cls.search([
|
||||
('id', '=', project_id),
|
||||
('type', '=', 'project'),
|
||||
])
|
||||
|
||||
if not project:
|
||||
if not projects:
|
||||
raise abort(404)
|
||||
|
||||
if not project.can_read(request.nereid_user):
|
||||
if not projects[0].can_read(request.nereid_user):
|
||||
# If the user is not allowed to access this project then dont let
|
||||
raise abort(404)
|
||||
|
||||
return project
|
||||
return projects[0]
|
||||
|
||||
@classmethod
|
||||
def get_task(cls, task_id):
|
||||
|
@ -484,19 +484,19 @@ class Project:
|
|||
|
||||
:param task_id: Task Id of project to fetch.
|
||||
"""
|
||||
task, = cls.search([
|
||||
tasks = cls.search([
|
||||
('id', '=', task_id),
|
||||
('type', '=', 'task'),
|
||||
])
|
||||
|
||||
if not task:
|
||||
if not tasks:
|
||||
raise abort(404)
|
||||
|
||||
if not task.parent.can_write(request.nereid_user):
|
||||
if not tasks[0].parent.can_write(request.nereid_user):
|
||||
# If the user is not allowed to access this project then dont let
|
||||
raise abort(403)
|
||||
|
||||
return task
|
||||
return tasks[0]
|
||||
|
||||
@classmethod
|
||||
def get_tasks_by_tag(cls, tag_id):
|
||||
|
|
Loading…
Reference in New Issue