From 45f244a2d5d368d641d6de6754950b059a414c8d Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 4 Jun 2018 17:40:06 +0100 Subject: [PATCH] Bug fix adding xanadoc span references to database. --- sourcing/cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sourcing/cli.py b/sourcing/cli.py index 5251c40..827e06e 100644 --- a/sourcing/cli.py +++ b/sourcing/cli.py @@ -66,11 +66,13 @@ def populate_references(): continue for url, start, length in doc_edl['spans']: src_doc = model.Item.from_external(url, home=home) + if not src_doc.id: + continue print(xanadoc.id, '->', src_doc.id) - as_tuple = (link_obj.id, item.id) + as_tuple = (xanadoc.id, src_doc.id) if as_tuple in seen: continue - ref = model.Reference(subject_id=link_obj.id, object_id=item.id) + ref = model.Reference(subject_id=xanadoc.id, object_id=src_doc.id) database.session.add(ref) seen.add(as_tuple)