Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Properly handle bugzilla urls for unretirement requests #360

Merged
merged 7 commits into from Jun 8, 2016
Merged

Properly handle bugzilla urls for unretirement requests #360

merged 7 commits into from Jun 8, 2016

Conversation

tyll
Copy link
Contributor

@tyll tyll commented Jun 4, 2016

This PR first fixes the test suite to not report errors because of undefined exceptions, adds a test for the function to identify the probem, fixes the problem and also fixes some PEP8 violations in the touched files.

This should fix the problem in https://fedorahosted.org/rel-eng/ticket/6426

@@ -1972,15 +1975,21 @@ def add_new_package_request(
if pkg_collection.startswith(('el', 'epel')):
_validate_pkg(session, pkg_collection[-1:], pkg_name)

if pkg_description:
Copy link
Member

Choose a reason for hiding this comment

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

This actually changes the behavior we had, if pkg_description is ' ' it will return True while we want None in fact

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not follow. Before my change pkgdb would use the empty string if pkg_description is just a space character:

In [3]: pkg_description = " "

In [4]: pkg_description.strip() if pkg_description else None
Out[4]: ''

Copy link
Member

Choose a reason for hiding this comment

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

That's a bug then, it should be: pkg_description.strip() if pkg_description and pkg_description.strip() else None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this only needed for the description or ofr the other fields for the review URL and upstream URL 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.

All three fields apparently

tyll added 6 commits June 5, 2016 21:55
PkgdbBugzillaException is only defined in pkgdblib.exceptions not in pkgdblib.
This makes the testsuite run without errors.
pkg_description, pkg_upstream_url and pkg_review_url should be None
if they are empty, see:
#360 (comment)
@tyll
Copy link
Contributor Author

tyll commented Jun 5, 2016

I believe I addressed all your suggestions now.

@@ -151,7 +151,7 @@ def api_admin_actions():
status=status,
count=True,
)
except pkgdblib.PkgdbException, err: # pragma: no cover
except pkgdblib.PkgdbException as err: # pragma: no cover
Copy link
Member

Choose a reason for hiding this comment

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

Here we use pkgdblib.PkgdbException but wasn't this the problem we were trying to address at first?

We adjusted api/acls.py to import the exception directly, should we adjust the others to behave in the same way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem was with PkgdbBugzillaException the PkgdbException is also availible in pkgdblib, because it is imported there. We can also make it the same in the other places, but it is going to extend the scope of this PR beyond its original goal.

Copy link
Member

Choose a reason for hiding this comment

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

I realize it is available in pkgdblib, but somehow it was failing in the tests despite that.
So, imho, either we are consistent and fix it everywhere or figure out more precisely why the tests were failing

Copy link
Contributor Author

@tyll tyll Jun 7, 2016

Choose a reason for hiding this comment

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

So, imho, either we are consistent and fix it everywhere or figure out more precisely why the tests were failing

There are two different exceptions, one with Bugzilla it is name. This one caused the test failure. The changes to the exception withouth Bugzilla in its name was there to make it more consistent.

@pypingou
Copy link
Member

pypingou commented Jun 7, 2016

I'm wondering if we shouldn't split this PR into two so that we can merge the fix to bugzilla URLs on one side and deal with the exceptions in another PR

@tyll
Copy link
Contributor Author

tyll commented Jun 7, 2016

I hope I got all exceptions and made made it uniform. If there are no other changes IMHO a second PR makes it only more complicated without much gain.

@pypingou
Copy link
Member

pypingou commented Jun 7, 2016

I hope I got all exceptions and made made it uniform.

You got them all in the API but missed the imports in the UI module, do you want me to do it?

If there are no other changes IMHO a second PR makes it only more complicated without much gain.

I'm fine with keeping it all in one PR, I was suggesting splitting as a way to not stalling these changes :)

@pypingou
Copy link
Member

pypingou commented Jun 7, 2016

I hope I got all exceptions and made made it uniform.

You got them all in the API but missed the imports in the UI module, do you want me to do it?

Ok I must have had an old cache or so since I can now see the imports everywhere.

Thanks for this PR, sorry it turned out to be that big :)

@pypingou
Copy link
Member

pypingou commented Jun 7, 2016

👍 to merge

@tyll tyll merged commit 31b203a into fedora-infra:master Jun 8, 2016
@tyll
Copy link
Contributor Author

tyll commented Jun 8, 2016

Thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants