diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index 91b787961..95048eabf 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -151,12 +151,12 @@ def get_apis(): if current_service.service_callback_api: callback_api = service_api_client.get_service_callback_api( current_service.id, - current_service.get('service_callback_api')[0] + current_service.service_callback_api[0] ) if current_service.inbound_api: inbound_api = service_api_client.get_service_inbound_api( current_service.id, - current_service.get('inbound_api')[0] + current_service.inbound_api[0] ) return (callback_api, inbound_api) @@ -251,7 +251,7 @@ def get_received_text_messages_callback(): if current_service.inbound_api: return service_api_client.get_service_inbound_api( current_service.id, - current_service.get('inbound_api')[0] + current_service.inbound_api[0] ) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 5a00f47d0..25e2f29c3 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -782,7 +782,7 @@ def service_set_letter_contact_block(service_id): @user_is_platform_admin def set_organisation_type(service_id): - form = OrganisationTypeForm(organisation_type=current_service.get('organisation_type')) + form = OrganisationTypeForm(organisation_type=current_service.organisation_type) if form.validate_on_submit(): free_sms_fragment_limit = current_app.config['DEFAULT_FREE_SMS_FRAGMENT_LIMITS'].get( @@ -885,7 +885,7 @@ def set_letter_branding(service_id): ) return redirect(url_for('.service_settings', service_id=service_id)) - form.dvla_org_id.data = current_service.get('dvla_organisation', '001') + form.dvla_org_id.data = current_service.dvla_organisation return render_template( 'views/service-settings/set-letter-branding.html', diff --git a/app/models/service.py b/app/models/service.py index 79964e931..e9b1e7ae4 100644 --- a/app/models/service.py +++ b/app/models/service.py @@ -53,10 +53,9 @@ class Service(): ) def get(self, attr, default=None): - try: - return self._dict[attr] - except KeyError: - return default + raise NotImplementedError( + 'Use current_service.{} instead of current_service.get(\'{}\')'.format(attr, attr) + ) @property def trial_mode(self):