From 7b9266b25db638fe7b1fb8033b4752d59e2ee7c6 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 17 Apr 2020 21:39:28 +0100 Subject: [PATCH] created date: add fallback for missing/unexpected title format --- my/roamresearch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/my/roamresearch.py b/my/roamresearch.py index 6fb314e..36bc881 100644 --- a/my/roamresearch.py +++ b/my/roamresearch.py @@ -42,10 +42,12 @@ class Node(NamedTuple): # ugh. daily notes don't have create time for some reason??? title = self.title - assert title is not None + if title is None: + return self.edited # fallback TODO log? # the format is 'February 8th, 2020'. Fucking hell. m = re.fullmatch(r'(\w+) (\d+)\w+, (\d+)', title) - assert m is not None + if m is None: + return self.edited # fallback TODO log? # strip off 'th'/'rd' crap dts = m.group(1) + ' ' + m.group(2) + ' ' + m.group(3) dt = datetime.strptime(dts, '%B %d %Y')