Commit 7acce55c authored by Matthieu Boileau's avatar Matthieu Boileau

notify expiration_date for job_offer (#57)

parent 53fc881e
Pipeline #3807 passed with stages
in 2 minutes and 55 seconds
......@@ -3,7 +3,7 @@ Date: 2019-04-08 14:53
Slug: job_45a72ce310de2158697917bc80a56b77
Category: job
Authors: Roland
Email:
Email: roland.denis@math.univ-lyon1.fr
Job_Type: CDD
Tags: cdd
Template: job_offer
......@@ -14,4 +14,4 @@ Job_Employer: CNRS
Expiration_Date: 2019-04-09
Attachment:
Il faut candidater très vite, cette offre disparaîtra demain \!
\ No newline at end of file
Il faut candidater très vite, cette offre disparaîtra demain \!
......@@ -53,18 +53,19 @@ class Message:
with open(filepath) as f:
s = f.read()
# TODO: When expire_date will be in job_*.md file
# m = re.search("Date: (.*)$", s, re.MULTILINE)
# date = m.group(1)
# expire_date to format...
m = re.search("Authors: (.*)$", s, re.MULTILINE)
m = re.search(r"^Authors: (.*)$", s, re.MULTILINE)
self.author_name = m.group(1).title()
m = re.search("Email: (.*)$", s, re.MULTILINE)
m = re.search(r"^Email: (.*)$", s, re.MULTILINE)
self.author_email = m.group(1)
m = re.search("Job_Type: (.*)$", s, re.MULTILINE)
m = re.search(r"^Job_Type: (.*)$", s, re.MULTILINE)
self.job_type = m.group(1).lower()
m = re.search("Title: (.*)$", s, re.MULTILINE)
m = re.search(r"^Title: (.*)$", s, re.MULTILINE)
self.job_title = m.group(1)
m = re.search(r"^Expiration_Date: (.*)$", s, re.MULTILINE)
if m:
self.expire_date = datetime.datetime.strptime(m.group(1), '%Y-%m-%d')
else:
self.expire_date = datetime.date.today() + datetime.timedelta(days=90)
def get_email_body(self):
"""Virtual function"""
......@@ -112,14 +113,10 @@ $PUBLISHER_MESSAGE bureau du groupe Calcul.
self.recipient_email = self.author_email
def get_email_body(self):
"""Parse job offer md file to build email body"""
expire_date = datetime.date.today() + datetime.timedelta(days=90)
self.d['EXPIRE_DATE'] = '{d.day} {d:%B} {d.year}'.format(d=expire_date)
"""Return email body from template"""
self.d['EXPIRE_DATE'] = '{d.day} {d:%B} {d.year}'.format(d=self.expire_date)
body = self.template.substitute(self.d)
return body
......
Markdown is supported
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