From 1c27cba52ea77685c22377700c43c8834231a789 Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 22 May 2017 22:59:01 +0200 Subject: [PATCH] cleanup + verbose build --- Makefile | 5 +++++ README.md | 5 +++-- plugins/talks.py | 26 ++++++++++++++------------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 42fb95c..4ef71f4 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ DEBUG ?= 0 ifeq ($(DEBUG), 1) PELICANOPTS += -D endif +VERBOSE ?= 0 +ifeq ($(VERBOSE), 1) + PELICANOPTS += -v +endif help: @echo 'Makefile for a pelican Web site ' @@ -25,6 +29,7 @@ help: @echo ' make devserver [PORT=8000] start/restart develop_server.sh ' @echo ' make stopserver stop local server ' @echo ' ' + @echo 'Set the VERBOSE variable to 1 for some more messages, e.g. make VERBOSE=1 html' @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html' @echo ' ' diff --git a/README.md b/README.md index 3f04282..819b7b6 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,15 @@ Also, `make help` is your friend. **Morte ai nemici dell'UTF-8** +Se devi debuggare, `make DEBUG=1 publish` + Aggiungere un talk -------------------- -```sh +``` cp -r talks/_talk_example/ talks/MIOTALK/ vim talks/MIOTALK/meta.yaml ``` Quindi rifai `make publish` come spiegato prima: l'output ti informa di eventuali errori nei campi o sovrapposizioni con altri talk, leggilo! - diff --git a/plugins/talks.py b/plugins/talks.py index 8593539..ae5651f 100644 --- a/plugins/talks.py +++ b/plugins/talks.py @@ -98,7 +98,7 @@ def get_talk_data(talkname): with io.open(fname, encoding='utf8') as buf: try: data = yaml.load(buf) - except Exception as exc: + except: logging.exception("Syntax error reading %s; skipping", fname) return None if data is None: @@ -134,15 +134,16 @@ def get_talk_data(talkname): if 'day' in data: del data['day'] if 'day' in data: - data['day'] = get_global_data()['startdate'] + datetime.timedelta(days=data['day']) + data['day'] = get_global_data()['startdate'] + \ + datetime.timedelta(days=data['day']) if 'time' in data and 'day' in data: timeparts = re.findall(r'\d+', str(data['time'])) if 4 > len(timeparts) > 0: timeparts = [int(p) for p in timeparts] - data['time'] = datetime.datetime.combine(data['day'], - datetime.time(*timeparts)) + data['time'] = datetime.datetime.combine( + data['day'], datetime.time(*timeparts)) else: - logging.error("Talk <{}> has malformed `time`".format(talkname)) + logging.error("Talk <%s> has malformed `time`", talkname) data['id'] = talkname resdir = os.path.join(TALKS_PATH, talkname, TALK_ATTACHMENT_PATH) if os.path.isdir(resdir) and os.listdir(resdir): @@ -251,16 +252,16 @@ class TalkGridDirective(Directive): times[position + i*GRID_STEP][roomnum] = copy(talk) times[position + i*GRID_STEP][roomnum]['skip'] = True - #with setlocale(locale.normalize(lang)): render = tmpl.render(times=times, rooms=rooms, mintime=mintime, maxtime=maxtime, timestep=GRID_STEP, lang=lang, ) - output.append(nodes.raw('', u'

%s

' % - format_date(day, format='full', locale=lang), - format='html')) + output.append(nodes.raw( + '', u'

%s

' % format_date(day, format='full', + locale=lang), + format='html')) output.append(nodes.raw('', render, format='html')) return output @@ -280,17 +281,18 @@ def talk_to_ics(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']) + end = start + datetime.timedelta(minutes=talk['duration']) content = 'BEGIN:VEVENT\n' content += "UID:%s@%d.hackmeeting.org\n" % (talk['id'], talk['day'].year) content += "SUMMARY:%s\n" % talk['title'] content += "DTSTAMP:%s\n" % time.strftime('%Y%m%dT%H%M%SZ', - time.gmtime(float(start.strftime('%s')))) + time.gmtime(float( + start.strftime('%s')))) content += "DTSTART:%s\n" % time.strftime('%Y%m%dT%H%M%SZ', time.gmtime(float( start.strftime('%s')))) content += "DTEND:%s\n" % time.strftime('%Y%m%dT%H%M%SZ', - time.gmtime(float( + time.gmtime(float( end.strftime('%s')))) content += "LOCATION:%s\n" % talk['room'] content += 'END:VEVENT\n'