forked from boyska/sito-hackit-17
errori un po piu chiari
This commit is contained in:
parent
01827360bc
commit
b859aa8d8f
1 changed files with 52 additions and 45 deletions
|
@ -103,6 +103,7 @@ def get_talk_data(talkname):
|
|||
return None
|
||||
if data is None:
|
||||
return None
|
||||
try:
|
||||
if 'title' not in data:
|
||||
logging.warn("Talk <{}> has no `title` field".format(talkname))
|
||||
data['title'] = talkname
|
||||
|
@ -147,6 +148,9 @@ def get_talk_data(talkname):
|
|||
if os.path.isdir(resdir) and os.listdir(resdir):
|
||||
data['resources'] = resdir
|
||||
return data
|
||||
except:
|
||||
logging.exception("Error on talk %s", talkname)
|
||||
raise
|
||||
|
||||
|
||||
jinja_env = jinja2.Environment(
|
||||
|
@ -264,13 +268,16 @@ class TalkGridDirective(Directive):
|
|||
def talks_to_ics():
|
||||
content = u'BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:pelican\n'
|
||||
for t in all_talks():
|
||||
try:
|
||||
content += talk_to_ics(t)
|
||||
except:
|
||||
logging.exception("Error producing calendar for talk %s", t['id'])
|
||||
content += 'END:VCALENDAR\n'
|
||||
return content
|
||||
|
||||
|
||||
def talk_to_ics(talk):
|
||||
if 'time' not in talk or 'duration' not in talk:
|
||||
if 'time' not in talk or 'duration' not in talk or 'room' not in talk:
|
||||
return ''
|
||||
start = talk['time']
|
||||
end = start + datetime.timedelta(minutes=talk['duration'])
|
||||
|
|
Loading…
Reference in a new issue