Commit 8a2bf75f authored by Dax Mickelson's avatar Dax Mickelson

Improve EXAMPLE_SCRIPT flow

parent f36bf47e
......@@ -27,17 +27,18 @@ def main() -> None:
raw_csv_input = csv.DictReader(f, quotechar='"', fieldnames=fieldnames)
# Use the collected information to build each extension
for row in raw_csv_input:
# Skip blank rows, or rather, rows with no data in the first field.
extension = row['Extension']
name = f"{row['First Name'].strip().capitalize()} {row['Last Name'].strip().capitalize()}"
email = f"{row['First Name'].strip().lower()}.{row['Last Name'].strip().lower()}@{EMAIL_DOMAIN}"
# Now that the pertinent information has been formatted, build the extension class
data_vars = {'name': name,
'extension': extension,
'voicemail_vmpwd': VOICEMAIL_PASSWORD,
'voicemail_email': email}
extensions.append(Extension(**data_vars))
# Skip the header row and blank rows, or rather, rows with no data in the first field.
if row['Extension'] and row['Extension'] != 'Extension':
extension = row['Extension']
name = f"{row['First Name'].strip().capitalize()} {row['Last Name'].strip().capitalize()}"
email = f"{row['First Name'].strip().lower()}.{row['Last Name'].strip().lower()}@{EMAIL_DOMAIN}"
# Now that the pertinent information has been formatted, build the extension class
data_vars = {'name': name,
'extension': extension,
'voicemail_vmpwd': VOICEMAIL_PASSWORD,
'voicemail_email': email}
extensions.append(Extension(**data_vars))
# Write finished extensions to a csv file.
write_csv_file(extensions)
......
......@@ -6,7 +6,7 @@ __license__ = "BSD"
setup(
name='freepbx_bulk_handler',
version='0.51',
version='0.52',
description="Assist administrators of FreePBX systems when they need to use the Bulk Handler module",
long_description="""This python package is designed to assist administrators of FreePBX systems when
they need to use the Bulk Handler module.""",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment