minor and major reworks: rename swb to SRU, add a test for pdf parsing

major: rework mail to send mail as plaintext instead of html, preventing the bleed-in of html text
This commit is contained in:
2025-10-07 14:15:10 +02:00
parent 0df7fd9fe6
commit 06965db26a
25 changed files with 1174 additions and 303 deletions

View File

@@ -1,7 +1,9 @@
from pyzotero import zotero
from dataclasses import dataclass
from src.logic.webrequest import WebRequest, BibTextTransformer
from pyzotero import zotero
from src import settings
from src.logic.webrequest import BibTextTransformer, WebRequest
@dataclass
@@ -187,7 +189,7 @@ class ZoteroController:
book = bib.return_data()
return book
# # print(zot.item_template("bookSection"))
# # #print(zot.item_template("bookSection"))
def createBook(self, isbn):
book = self.__get_data(isbn)
@@ -210,7 +212,7 @@ class ZoteroController:
def createItem(self, item):
resp = self.zot.create_items([item])
if "successful" in resp.keys():
# print(resp["successful"]["0"]["key"])
# #print(resp["successful"]["0"]["key"])
return resp["successful"]["0"]["key"]
else:
return None
@@ -220,7 +222,7 @@ class ZoteroController:
for item in items:
if item["key"] == key:
self.zot.delete_item(item)
# print(item)
# #print(item)
break
def createHGSection(self, book: Book, data: dict):
@@ -241,7 +243,7 @@ class ZoteroController:
]
chapter.creators += authors
# print(chapter.to_dict())
# #print(chapter.to_dict())
return self.createItem(chapter.to_dict())
pass
@@ -257,7 +259,7 @@ class ZoteroController:
# chapter.creators
def createJournalArticle(self, journal, article):
# print(type(article))
# #print(type(article))
journalarticle = JournalArticle()
journalarticle.assign(journal)
journalarticle.itemType = "journalArticle"
@@ -273,7 +275,7 @@ class ZoteroController:
journalarticle.issue = article["issue"]
journalarticle.url = article["isbn"]
# print(journalarticle.to_dict())
# #print(journalarticle.to_dict())
return self.createItem(journalarticle.to_dict())
@@ -319,16 +321,16 @@ if __name__ == "__main__":
# if isinstance(publishers, str):
# publishers = [publishers]
# for publisher in publishers:
# # print(publisher)
# # #print(publisher)
# creator = Creator().from_string(publisher)
# creator.creatorType = "editor"
# authors.append(creator.__dict__)
# chapter.creators = authors
# chapter.publisher = book.publisher
# # print(chapter.to_dict())
# # #print(chapter.to_dict())
# createBookSection(chapter.to_dict())
# get_citation("9ZXH8DDE")
# # # print()
# # print(get_books())
# # print(zot.item_creator_types("bookSection"))
# # # #print()
# # #print(get_books())
# # #print(zot.item_creator_types("bookSection"))