Browse Source

changed email message to something nice

pull/1/head
Holger Frey 5 years ago
parent
commit
59c809b35a
  1. 18
      superx_budget/pyramid/overview.py
  2. BIN
      test_data/Verwendungsnachweis_und_Kassenstand_SAP.xlsx
  3. BIN
      test_data/Verwendungsnachweis_und_Kassenstand_SAP_Zahlen.xlsx
  4. 2
      tests/conftest.py

18
superx_budget/pyramid/overview.py

@ -13,6 +13,18 @@ from ..helpers import find_recipients, find_budget_file, get_sheet_of_file
from ..overview import create_overview # noqa: F401 from ..overview import create_overview # noqa: F401
from ..exceptions import BudgetParserError, SuperXParserError # noqa: F401 from ..exceptions import BudgetParserError, SuperXParserError # noqa: F401
MAIL_MESSAGE_BODY = """Hallo an Alle,
anbei ist eine aktuelle Übersicht unserer Verbrauchsmittel-Budgets.
Frohes Bestellen!
--
Dies ist eine automatisch generierte Email,
bei Fragen bitte an Holgi wenden
"""
@view_config( @view_config(
context=dict, context=dict,
@ -126,14 +138,14 @@ def send_overview(context, request):
cell = f"F{row}" cell = f"F{row}"
sheet[cell] = value sheet[cell] = value
budget_year = budget_file.stem.split("-")[-1]
message = Message( message = Message(
subject=f"Budget Übersicht, Stand {export_date}", subject=f"Budget Übersicht {budget_year}, Stand {export_date}",
sender="cpiserver@imtek.uni-freiburg.de", sender="cpiserver@imtek.uni-freiburg.de",
recipients=recipients, recipients=recipients,
body="hello from ford", body=MAIL_MESSAGE_BODY,
) )
budget_year = budget_file.stem.split("-")[-1]
xls_name = f"{export_date}-Budget-Overview-{budget_year}.xlsx" xls_name = f"{export_date}-Budget-Overview-{budget_year}.xlsx"
with NamedTemporaryFile() as tmp: with NamedTemporaryFile() as tmp:
sheet._parent.save(tmp.name) sheet._parent.save(tmp.name)

BIN
test_data/Verwendungsnachweis_und_Kassenstand_SAP.xlsx

Binary file not shown.

BIN
test_data/Verwendungsnachweis_und_Kassenstand_SAP_Zahlen.xlsx

Binary file not shown.

2
tests/conftest.py

@ -41,7 +41,7 @@ def budget_example_sheet(budget_example_workbook):
@pytest.fixture @pytest.fixture
def superx_example_file(example_root): def superx_example_file(example_root):
return example_root / "Verwendungsnachweis_und_Kassenstand_SAP_Zahlen.xlsx" return example_root / "Verwendungsnachweis_und_Kassenstand_SAP.xlsx"
@pytest.fixture @pytest.fixture

Loading…
Cancel
Save