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

Update the release component serializer file #181

Merged
merged 1 commit into from
Oct 30, 2015
Merged

Update the release component serializer file #181

merged 1 commit into from
Oct 30, 2015

Conversation

bliuredhat
Copy link
Contributor

The code in component serializer is not reachable,
and remove the unreachable code.

JIRA: PDC-1053

self._errors = {'release': 'This field is required.'}
return
release = get_object_or_404(Release, release_id=release_id)
if not release.is_active():
Copy link
Contributor

Choose a reason for hiding this comment

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

If we need to keep the check of "Not create release component with an inactive release", we'd better keep validate_release here.
The reason that test here get passed is because the 'releases' in data is should be 'release'.
Please correct other tests of ReleaseComponent that with 'releases' in data as well.

Copy link
Member

Choose a reason for hiding this comment

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

@xychu That's a good point. However, the validation still needs to be updated, because the value argument is always an instance of Release. Raising ValidationError would also be a preferable way of failing.

Please note that for bulk update, the key is actually called releases, so this is quite confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, the isinstance check, which is left from DRFv2.4, is no more needed now.

@bliuredhat
Copy link
Contributor Author

@lubomir and @xychu ; thank you so much and I will rewrite the script as followed your suggestion~!

@bliuredhat
Copy link
Contributor Author

@lubomir and @xychu , whether this branch can be merged to master branch ~?

@bliuredhat bliuredhat force-pushed the PDC-1053 branch 2 times, most recently from b2680c9 to 1368353 Compare October 29, 2015 06:37
@lubomir
Copy link
Member

lubomir commented Oct 29, 2015

This looks good to me.

 The code in component serializer is not reachable,
 and remove the unreachable code.

 and then, verify the test case file.

 JIRA: PDC-1053
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.

None yet

3 participants