mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
remove pdf/png code from admin app entirely
while PDFs work on paas, they only do that because it turns out the python buildpack happens to have imagemagick preinstalled - if that ever changes then it'd break. so move those to the template preview service. This also means we can get rid of weazyprint and wand dependencies
This commit is contained in:
17
app/utils.py
17
app/utils.py
@@ -16,8 +16,6 @@ from flask import (
|
||||
)
|
||||
from flask_login import current_user
|
||||
|
||||
from wand.image import Image
|
||||
|
||||
from notifications_utils.template import (
|
||||
SMSPreviewTemplate,
|
||||
EmailPreviewTemplate,
|
||||
@@ -327,21 +325,6 @@ def get_template(
|
||||
)
|
||||
|
||||
|
||||
def png_from_pdf(pdf_endpoint):
|
||||
output = BytesIO()
|
||||
with Image(
|
||||
blob=pdf_endpoint.get_data(),
|
||||
resolution=150,
|
||||
) as image:
|
||||
with image.convert('png') as converted:
|
||||
converted.save(file=output)
|
||||
output.seek(0)
|
||||
return dict(
|
||||
filename_or_fp=output,
|
||||
mimetype='image/png',
|
||||
)
|
||||
|
||||
|
||||
def get_current_financial_year():
|
||||
now = datetime.utcnow()
|
||||
current_month = int(now.strftime('%-m'))
|
||||
|
||||
Reference in New Issue
Block a user