Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Add a numeric prefix to filenames to allow non alphabetical ordering of organizations #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

macdiesel
Copy link
Contributor

No description provided.

@macdiesel macdiesel requested review from pwnage101 and brianhw April 22, 2019 15:41
org_config = get_config_for_org(config, organization)

bucket = org_config['output_bucket']
organization = organization.lower()

if any(fnmatch(organization, org) for org in orgs):
filename = os.path.join(directory, organization)
prefix = "{counter:05d}_".format(counter=org_counter)
filename = os.path.join(directory, prefix, organization)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will create prefix as a separate subdirectory, no? You could include the organization in with the prefix format statement.....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fudge. Treated it as a concat, not really what I wanted. Will fix.

@@ -59,15 +59,16 @@ def export_properties(config, directory, files=None, orgs=None, prefix=''):

files_data = load_files(files)

for organization in config['organizations']:
for org_counter, organization in enumerate(config['organizations']):
Copy link
Contributor

Choose a reason for hiding this comment

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

Here's a way to deal with a priority on a few entries:
orgconfig = config['organizations']
def check_priority(org):
if 'priority' in orgconfig[org]:
return org.upper()
else:
return org.lower()

for org_counter, organization in enumerate(sorted(orgconfig, key = check_priority)):

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.

2 participants