diff --git a/books/views.py b/books/views.py index 5a79c6c4..113dad8c 100644 --- a/books/views.py +++ b/books/views.py @@ -311,7 +311,7 @@ def create_update_mark(request): visibility = TootVisibilityEnum.UNLISTED url = "https://" + request.get_host() + reverse("books:retrieve", args=[book.id]) - words = BookMarkStatusTranslator(int(form.cleaned_data['status'])) +\ + words = BookMarkStatusTranslator(form.cleaned_data['status']) +\ f"《{book.title}》" + \ rating_to_emoji(form.cleaned_data['rating']) diff --git a/common/scraper.py b/common/scraper.py index 89bdb363..02770ab2 100644 --- a/common/scraper.py +++ b/common/scraper.py @@ -46,7 +46,7 @@ scraper_registry = {} def log_url(func): """ Catch exceptions and log then pass the exceptions. - First postion argument of decorated function must be the url. + First postion argument (except cls/self) of decorated function must be the url. """ @functools.wraps(func) def wrapper(*args, **kwargs): @@ -54,7 +54,7 @@ def log_url(func): return func(*args, **kwargs) except Exception as e: # log the url - logger.error(f"Scrape Failed URL: {args[0]}") + logger.error(f"Scrape Failed URL: {args[1]}") logger.error(str(e)) raise e @@ -102,10 +102,10 @@ class AbstractScraper: @classmethod def get_effective_url(cls, raw_url): - url = cls.regex.findall(raw_url)[0] + url = cls.regex.findall(raw_url) if not url: raise ValueError("not valid url") - return url + return url[0] @classmethod def download_page(cls, url, headers): diff --git a/common/static/js/detail.js b/common/static/js/detail.js index 9b14f98a..a4548c3a 100644 --- a/common/static/js/detail.js +++ b/common/static/js/detail.js @@ -75,7 +75,7 @@ $(document).ready( function() { }); // hide rating star when select wish - const WISH_CODE = 1; + const WISH_CODE = "wish"; if ($("#statusSelection input[type='radio']:checked").val() == WISH_CODE) { $(".mark-modal .rating-star-edit").hide(); } diff --git a/common/templates/partial/_navbar.html b/common/templates/partial/_navbar.html index d39addc2..a129a7ab 100644 --- a/common/templates/partial/_navbar.html +++ b/common/templates/partial/_navbar.html @@ -9,7 +9,7 @@ -