Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Fabrice Roy
fork-website-calcul
Commits
7acce55c
Commit
7acce55c
authored
Apr 09, 2019
by
Matthieu Boileau
Browse files
notify expiration_date for job_offer (#57)
parent
53fc881e
Changes
2
Hide whitespace changes
Inline
Side-by-side
content/job_offers/job_45a72ce310de2158697917bc80a56b77.md
View file @
7acce55c
...
...
@@ -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
\!
utils/notify_job_offer.py
View file @
7acce55c
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment