Merge pull request #1646 from alphagov/add-tags-to-pdf-letters

upload letter pdfs with retention tag
This commit is contained in:
Leo Hemsted
2018-02-12 15:03:53 +00:00
committed by GitHub
5 changed files with 15 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ from notifications_utils.s3 import s3upload
from app import notify_celery
from app.aws import s3
from app.config import QueueNames, TaskNames
from app.variables import Retention
from app.dao.notifications_dao import (
get_notification_by_id,
update_notification_status_by_id,
@@ -68,7 +69,8 @@ def create_letters_pdf(self, notification_id):
filedata=pdf_data,
region=current_app.config['AWS_REGION'],
bucket_name=current_app.config['LETTERS_PDF_BUCKET_NAME'],
file_location=upload_file_name
file_location=upload_file_name,
tags={Retention.KEY: Retention.ONE_WEEK}
)
current_app.logger.info("Uploaded letters PDF {} to {}".format(

View File

@@ -1,3 +1,10 @@
# all jobs for letters created via the api must have this filename
LETTER_API_FILENAME = 'letter submitted via api'
LETTER_TEST_API_FILENAME = 'test letter submitted via api'
# S3 tags
class Retention:
KEY = 'retention'
ONE_WEEK = 'ONE_WEEK'