Revert "Merge pull request #2887 from alphagov/cache-the-serialised-things"

This reverts commit b8c2c6b291, reversing
changes made to 351aca2c5a.
This commit is contained in:
Chris Hill-Scott
2020-06-26 13:42:44 +01:00
parent b8fe7b8e61
commit 7e85e37e1d
15 changed files with 50 additions and 215 deletions

View File

@@ -332,7 +332,7 @@ def process_letter_notification(
if api_key.key_type == KEY_TYPE_TEAM:
raise BadRequestError(message='Cannot send letters with a team api key', status_code=403)
if not service.research_mode and service.restricted and api_key.key_type != KEY_TYPE_TEST:
if not api_key.service.research_mode and api_key.service.restricted and api_key.key_type != KEY_TYPE_TEST:
raise BadRequestError(message='Cannot send letters when service is in trial mode', status_code=403)
if precompiled:
@@ -342,7 +342,7 @@ def process_letter_notification(
template=template,
reply_to_text=reply_to_text)
validate_address(service, letter_data)
validate_address(api_key, letter_data)
test_key = api_key.key_type == KEY_TYPE_TEST
@@ -391,10 +391,10 @@ def process_letter_notification(
return resp
def validate_address(service, letter_data):
def validate_address(api_key, letter_data):
address = PostalAddress.from_personalisation(
letter_data['personalisation'],
allow_international_letters=(INTERNATIONAL_LETTERS in service.permissions),
allow_international_letters=api_key.service.has_permission(INTERNATIONAL_LETTERS),
)
if not address.has_enough_lines:
raise ValidationError(