Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b18a5be3 authored by Samuel Mimram's avatar Samuel Mimram
Browse files

Fix python3 usage.

parent cf9ec5d6
No related branches found
No related tags found
No related merge requests found
Pipeline #1185039 failed
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import yaml
import locale
from datetime import datetime, timedelta
......@@ -31,7 +32,7 @@ calendar.add('x-wr-calname', 'Proofs and Algorithms seminar')
f = open('../_data/seminar.yml')
events = yaml.load_all(f, Loader=yaml.FullLoader)
events = events.next()
events = next(events)
for data in events:
......@@ -45,28 +46,28 @@ for data in events:
# Compute fields
team = data['team']
team = "?" if team == None else team.encode("utf-8")
team = "?" if team == None else team
room = data['room']
if not room.startswith("http"):
room = "room " + ("TBA" if room == None else room.encode("utf-8"))
room = "room " + ("TBA" if room == None else room)
website = data['website']
website = "" if website == None else website.encode("utf-8")
speaker = data['speaker'].encode("utf-8")
website = "" if website == None else website
speaker = data['speaker']
lab = data['lab']
lab = "" if lab == None else lab.encode("utf-8")
lab = "" if lab == None else lab
picture = data['picture']
picture = "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Anonymous.svg/433px-Anonymous.svg.png" if picture == None else picture
picture = "<a href=\"{website}\"><img src=\"{picture}\" class=\"picture\" alt=\"{speaker}\"/></a>".format(speaker=speaker,website=website,picture=picture.encode("utf-8"))
picture = "<a href=\"{website}\"><img src=\"{picture}\" class=\"picture\" alt=\"{speaker}\"/></a>".format(speaker=speaker,website=website,picture=picture)
picturetweet = data['picture']
picturetweet = "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Anonymous.svg/433px-Anonymous.svg.png" if picturetweet == None else picturetweet
# picturetweet = "<a href=\"{website}\"><img src=\"{picture}\" class=\"picture\" alt=\"{speaker}\"/></a>".format(speaker=speaker,website=website,picture=picture.encode("utf-8"))
# picturetweet = "<a href=\"{website}\"><img src=\"{picture}\" class=\"picture\" alt=\"{speaker}\"/></a>".format(speaker=speaker,website=website,picture=picture)
date = dateutil.parser.parse(data['date'],dayfirst=False)
date = tz.localize(date)
datestring = date.strftime('%A %d %B %Y at %Hh%M')
title = data['title']
title = "TBA" if title == None else title.encode("utf-8")
title = "TBA" if title == None else title
abstract = data['abstract']
abstract = "TBA" if abstract == None else abstract.encode("utf-8")
abstract = "TBA" if abstract == None else abstract
# Generate mail
if date - datetime.now(tz) > timedelta():
......@@ -163,6 +164,6 @@ for data in events:
f.close()
f = open("../seminar/calendar.ics", "w")
f = open("../seminar/calendar.ics", "wb")
f.write(calendar.to_ical())
f.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment