Skip to content

Commit

Permalink
make sure to always have the right path for loading the templates
Browse files Browse the repository at this point in the history
  • Loading branch information
lbernhard95 committed Oct 30, 2024
1 parent 07ff7db commit f7e497f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion scheduler/env.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from dotenv import load_dotenv
import os
import pathlib


BASE_PATH = pathlib.Path(__file__).parent.parent.resolve()

load_dotenv()

Expand All @@ -8,4 +12,6 @@ def get_gmail_sender_address() -> str:


def get_gmail_sender_pw() -> str:
return os.getenv("GMAIL_SENDER_PASSWORD")
return os.getenv("GMAIL_SENDER_PASSWORD")

print(BASE_PATH)
4 changes: 2 additions & 2 deletions scheduler/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


def send_bitpoll_invitation(receivers: List[str], bitpoll_link: str):
html = load_html_template("templates/poll_invitation.html")
html = load_html_template(f"{env.BASE_PATH}/templates/poll_invitation.html")
html = html.replace("YOUR_BITPOLL_LINK_HERE", bitpoll_link)

send(
Expand All @@ -22,7 +22,7 @@ def send_bitpoll_invitation(receivers: List[str], bitpoll_link: str):


def send_schafkopf_meeting_invitation(receivers: List[str], start: datetime, bitpoll_link: str):
html = load_html_template("templates/schafkopf_scheduled.html")
html = load_html_template(f"{env.BASE_PATH}/templates/schafkopf_scheduled.html")
html = html.replace("SCHEDULED_DATE_PLACEHOLDER", format_datetime(start))
html = html.replace("YOUR_BITPOLL_LINK_HERE", bitpoll_link)

Expand Down

0 comments on commit f7e497f

Please sign in to comment.