forked from boyska/sito-hackit-17
better logging
This commit is contained in:
parent
cbd585babe
commit
81ec2cef95
1 changed files with 8 additions and 3 deletions
|
@ -50,7 +50,11 @@ def get_talk_data(talkname):
|
||||||
if not os.path.isfile(fname):
|
if not os.path.isfile(fname):
|
||||||
return None
|
return None
|
||||||
with io.open(fname, encoding='utf8') as buf:
|
with io.open(fname, encoding='utf8') as buf:
|
||||||
data = yaml.load(buf)
|
try:
|
||||||
|
data = yaml.load(buf)
|
||||||
|
except Exception as exc:
|
||||||
|
logging.exception("Syntax error reading %s; skipping", fname)
|
||||||
|
return None
|
||||||
if data is None:
|
if data is None:
|
||||||
return None
|
return None
|
||||||
if 'title' not in data:
|
if 'title' not in data:
|
||||||
|
@ -60,13 +64,14 @@ def get_talk_data(talkname):
|
||||||
logging.warn("Talk <{}> has no `text` field".format(talkname))
|
logging.warn("Talk <{}> has no `text` field".format(talkname))
|
||||||
data['text'] = ''
|
data['text'] = ''
|
||||||
if 'duration' not in data:
|
if 'duration' not in data:
|
||||||
logging.info("Talk <{}> has no `duration` field".format(talkname))
|
logging.info("Talk <{}> has no `duration` field (50min used)"
|
||||||
|
.format(talkname))
|
||||||
data['duration'] = 50
|
data['duration'] = 50
|
||||||
data['duration'] = int(data['duration'])
|
data['duration'] = int(data['duration'])
|
||||||
if 'room' not in data:
|
if 'room' not in data:
|
||||||
logging.warn("Talk <{}> has no `room` field".format(talkname))
|
logging.warn("Talk <{}> has no `room` field".format(talkname))
|
||||||
if 'time' not in data or 'day' not in data:
|
if 'time' not in data or 'day' not in data:
|
||||||
logging.error("Talk <{}> has no `time` or `day`".format(talkname))
|
logging.warn("Talk <{}> has no `time` or `day`".format(talkname))
|
||||||
if 'time' in data:
|
if 'time' in data:
|
||||||
timeparts = re.findall(r'\d+', str(data['time']))
|
timeparts = re.findall(r'\d+', str(data['time']))
|
||||||
if 4 > len(timeparts) > 0:
|
if 4 > len(timeparts) > 0:
|
||||||
|
|
Loading…
Reference in a new issue