def create_bibliographic_record(parser, creator, app): """ Creates a new document. If a document with the same This is called by the main parser loop if the document being imported is not already present in the system. """ document = get_doc(creator, parser.title, ed=parser.edition, vol=parser.volume) if document: app.log.info("Document already exists. Skipping %s" % (parser)) return document app.log.info("Creating bibliographic record for %s" % (parser.filepath)) document = Document(title=parser.title, edition=parser.edition, volume=parser.volume, pub_date=parser.pub_date) document.save() # self._create_author(document, parser.authorname, parser.author_role) return document
def _create_bibliographic_record(self): """ Creates a new document. This is called by the main parser loop if the document being imported is not already present in the system. """ return # FIXME move to a different class document = get_doc(self.title, edition=self.edition, volume=self.volume) if document: return document print(" Creating bibliographic record...") document = Document(title=self.title, edition=self.edition, volume=self.volume, pub_date=self.pub_date) document.save() self._create_author(document, self.authorname, self.author_role) return document