-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RDISCROWD-7573 update error on nonexistent project id in task API #989
Conversation
Pull Request Test Coverage Report for Build 11712107488Details
💛 - Coveralls |
pybossa/api/task.py
Outdated
@@ -102,6 +102,8 @@ def _preprocess_post_data(self, data): | |||
if 'n_answers' not in data: | |||
project = project_repo.get(project_id) | |||
data['n_answers'] = project.get_default_n_answers() | |||
if not project: | |||
raise BadRequest(f'Non existing project id {project_id}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are any other details of the request available inside data[]
that would help identify the caller? If so, those could be included in the exception details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the ticket comments for planned work on the gigwork listener to add identification for the caller. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to add test that will cover newly added condition and exception. Thanks
Issue number of the reported bug or feature request: RDISCROWD-7573
Describe your changes
add project null check after fetching project info in
_preprocess_post_data