Handle case where provider does not have international flag

This commit is contained in:
Imdad Ahad
2017-04-25 16:26:33 +01:00
parent 1788f10959
commit 116eac60d1
3 changed files with 14 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ def view_providers():
for provider in providers:
if provider['notification_type'] == 'sms':
domestic_sms_providers.append(provider)
if provider['supports_international']:
if provider.get('supports_international', None):
intl_sms_providers.append(provider)
elif provider['notification_type'] == 'email':
domestic_email_providers.append(provider)

View File

@@ -18,7 +18,7 @@ Providers
domestic_sms_providers,
caption="Domestic SMS providers",
caption_visible=False,
empty_message='No email providers',
empty_message='No domestic sms providers',
field_headings=['Provider', 'Priority', 'Active', 'Last Updated', 'Updated By'],
field_headings_visible=True
) %}
@@ -84,7 +84,7 @@ Providers
intl_sms_providers,
caption="International SMS providers",
caption_visible=False,
empty_message='No email providers',
empty_message='No international sms providers',
field_headings=['Provider', 'Priority', 'Active', 'Last Updated', 'Updated By'],
field_headings_visible=True
) %}

View File

@@ -73,6 +73,17 @@ stub_providers = {
'created_by': None,
'supports_international': True
},
{
'id': '67c770f5-918e-4afa-a5ff-880b9beb161d',
'active': False,
'priority': 10,
'display_name': 'International SMS Provider (no flag)',
'identifier': 'second_sms_international',
'notification_type': 'sms',
'updated_at': None,
'version': 1,
'created_by': None,
}
]
}