Skip to content
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

Use CharField.choices for Build.status_code #7166

Merged
merged 3 commits into from
Jun 9, 2020

Conversation

humitos
Copy link
Member

@humitos humitos commented Jun 8, 2020

We want to be able to communicate more than True/False status in this field.
This will help us to render different error messages to the user depending on
the Build.status_code.

#7123 was approved and merged, but I missed that usage of status_code there (I don't know why I used a boolean 🤷) but that is incorrect.

Also from #7123 (comment), I think it's better to use a CharField.choices that will communicate better the meaning, instead of a plain number.

We want to be able to communicate more than True/False status in this field.
This will help us to render different error messages to the user depending on
the `Build.status_code`.
@humitos humitos requested a review from ericholscher June 8, 2020 17:13
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems useful, but needs a bit more work to make it clear what exactly it is.

readthedocs/builds/models.py Outdated Show resolved Hide resolved
@humitos
Copy link
Member Author

humitos commented Jun 9, 2020

@ericholscher please, take a look at this again. We do need this to be merged before the release.

Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! 👍

In the future, using a registry pattern for our errors/statuses would save on duplicating status/error class attributes in our model's choice list, so maybe choices won't be the field type we ultimately use here. This is still a good step forward either way, and we can easily change this if we change our minds.

@agjohnson agjohnson merged commit d5f1bfc into master Jun 9, 2020
@agjohnson agjohnson deleted the humitos/status-code-choices branch June 9, 2020 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants