Commit ea563dc9 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

greet_newcomers: use a local shelf, as homes are not available by cron

parent 3d5a046a
......@@ -3,12 +3,13 @@
import shelve
from email.mime.text import MIMEText
from getpass import getuser
from os.path import abspath, dirname, expanduser, join
from smtplib import SMTP
from pathlib import Path
from ldap3 import Connection
SHELF = expanduser('~/.cache/gepetto_newcomers')
HERE = Path(__file__).resolve().parent
SHELF = HERE / '.cache'
def get_gepetto():
......@@ -49,7 +50,7 @@ def greet(to, sender):
if '@' not in to:
to = '' % to
with open(join(dirname(abspath(__file__)), 'template.txt')) as f:
with (HERE / 'template.txt').open() as f:
msg = MIMEText(
msg['Subject'] = 'Welcome in Gepetto !'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment