Skip to content
Snippets Groups Projects
Verified Commit f18f35f3 authored by !! Julian Keck (old Account; do not use) !!'s avatar !! Julian Keck (old Account; do not use) !! :ghost:
Browse files

UPD: print JSON-Object for patch-request in email

parent dcd51142
No related branches found
No related tags found
No related merge requests found
import html
import json
import pathlib
from typing import Optional
......@@ -342,7 +343,7 @@ def send_informal_petch_request(message: str, mgr: Mgr, receiver=settings.patch_
raise e
def send_patch_request(actions, mgr: Mgr, receiver=settings.patch_request_email_receivers,
def send_patch_request(actions: list[PatchRequestAction], mgr: Mgr, receiver=settings.patch_request_email_receivers,
reply_to: Optional[str] = None) -> bool:
try:
host_mode = db.host_omdl.OP_ENV_MODE.upper()
......@@ -350,10 +351,13 @@ def send_patch_request(actions, mgr: Mgr, receiver=settings.patch_request_email_
path = pathlib.Path(__file__).parent.parent.resolve()
TEMPLATE = 'templates/patch_request_template.j2'
raw_action_json = json.dumps(actions)
body = render_jinja_template(path, TEMPLATE,
actions=actions,
mgr=mgr,
host_mode=host_mode
host_mode=host_mode,
raw_action_json=raw_action_json,
)
building_numbers = ",".join(set([action.building.number for action in actions]))
......
......@@ -90,4 +90,10 @@
{% endfor %}
<p>Have a nice day!</p>
<br><br>
Raw request
<pre>
{{ raw_action_json | default('[]') }}
</pre>
</body>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment