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

Improve readability of pkgdb.lib.vcs_acls by using proper variable names #166

Merged
merged 5 commits into from Feb 26, 2015

Conversation

pypingou
Copy link
Member

Fixes #165

if pkg[0] not in output:
output[pkg[0].encode('utf-8')] = {}
if pkgname not in output:
output[pkgname.encode('utf-8')] = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 'utf-8' here? Would it make sense to keep it unicode while in this loop and then finally convert to byte strings at the very end?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that's a left over from when I tried to build the JSON by hand using a dict structure.

@ralphbean
Copy link
Contributor

Okay, another suggestion. This function contains two giant pieces on either side of if oformat == 'json':. Can you break those code-blocks into two separate functions?

if oformat == 'json':
    return _do_vcs_acls_json(arguments)
else:
    return _do_vcs_acls_the_other_format(arguments)

Then the docstring of each of those utility methods could describe what they're
for, what the different formats are like, what uses them, etc..

@pypingou
Copy link
Member Author

sure can do

name: pkg1,
branch: branch1,
user: [user1, user2],
group: [group1, group2]
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it should be groups not group and people not user (from reading the code below).

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh sorry, yes I was looking at the wrong method

@ralphbean
Copy link
Contributor

👍!

@pypingou
Copy link
Member Author

Thanks @ralphbean

pypingou added a commit that referenced this pull request Feb 26, 2015
Improve readability of pkgdb.lib.vcs_acls by using proper variable names
@pypingou pypingou merged commit 486627e into master Feb 26, 2015
@pypingou pypingou deleted the better_code branch February 26, 2015 15:45
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.

Clean up pkgdb2.lib:vcs_acls
2 participants