From c56a02bab6f1c84402071024addf44bf529e1e4f Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sat, 30 Sep 2017 15:24:18 +0200 Subject: [PATCH] Fix #339 --- cps/templates/author.html | 6 +++--- cps/templates/detail.html | 2 +- cps/templates/index.html | 2 +- cps/templates/json.txt | 4 ++-- cps/templates/search.html | 2 +- cps/templates/shelf.html | 2 +- cps/web.py | 8 +++++--- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cps/templates/author.html b/cps/templates/author.html index 59458824..78ddc8bb 100644 --- a/cps/templates/author.html +++ b/cps/templates/author.html @@ -39,7 +39,7 @@

{{entry.title|shortentitle}}

{% for author in entry.authors %} - {{author.name}} + {{author.name.replace('|',',')}} {% if not loop.last %} & {% endif %} @@ -66,7 +66,7 @@ {% if other_books %}

-

{{_("More by")}} {{ author.name|safe }}

+

{{_("More by")}} {{ author.name.replace('|',',')|safe }}

{% for entry in other_books %}
@@ -80,7 +80,7 @@

{% for author in entry.authors %} - {{author.name}} + {{author.name.replace('|',',')}} {% if not loop.last %} & diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 5fa60d14..1bdf9f96 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -62,7 +62,7 @@

{{entry.title}}

{% for author in entry.authors %} - {{author.name}} + {{author.name.replace('|',',')}} {% if not loop.last %} & {% endif %} diff --git a/cps/templates/index.html b/cps/templates/index.html index 9fb9291f..c78d090a 100755 --- a/cps/templates/index.html +++ b/cps/templates/index.html @@ -56,7 +56,7 @@

{{entry.title|shortentitle}}

{% for author in entry.authors %} - {{author.name}} + {{author.name.replace('|',',')}} {% if not loop.last %} & {% endif %} diff --git a/cps/templates/json.txt b/cps/templates/json.txt index be69bf7c..fa5239b1 100644 --- a/cps/templates/json.txt +++ b/cps/templates/json.txt @@ -41,7 +41,7 @@ "rating":{% if entry.ratings.__len__() > 0 %} "{{entry.ratings[0].rating}}.0"{% else %}0.0{% endif %}, "authors": [ {% for author in entry.authors %} - "{{author.name}}"{% if not loop.last %},{% endif %} + "{{author.name.replace('|',',')}}"{% if not loop.last %},{% endif %} {% endfor %} ], "other_formats": { @@ -51,4 +51,4 @@ {% endfor %} {% endif %} }, "title_sort": "{{entry.sort}}" -} \ No newline at end of file +} diff --git a/cps/templates/search.html b/cps/templates/search.html index b941d60d..378fc33e 100644 --- a/cps/templates/search.html +++ b/cps/templates/search.html @@ -24,7 +24,7 @@

{{entry.title|shortentitle}}

{% for author in entry.authors %} - {{author.name}} + {{author.name.replace('|',',')}} {% if not loop.last %} & {% endif %} diff --git a/cps/templates/shelf.html b/cps/templates/shelf.html index 46586925..aaecdf9c 100644 --- a/cps/templates/shelf.html +++ b/cps/templates/shelf.html @@ -24,7 +24,7 @@

{{entry.title|shortentitle}}

{% for author in entry.authors %} - {{author.name}} + {{author.name.replace('|',',')}} {% if not loop.last %} & {% endif %} diff --git a/cps/web.py b/cps/web.py index ca52e980..5873bad8 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1122,6 +1122,8 @@ def author_list(): entries = db.session.query(db.Authors, func.count('books_authors_link.book').label('count'))\ .join(db.books_authors_link).join(db.Books).filter(common_filters())\ .group_by('books_authors_link.author').order_by(db.Authors.sort).all() + for entry in entries: + entry.Authors.name=entry.Authors.name.replace('|',',') return render_title_template('list.html', entries=entries, folder='author', title=_(u"Author list")) @@ -1135,7 +1137,7 @@ def author(book_id, page): flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error") return redirect(url_for("index")) - name = db.session.query(db.Authors).filter(db.Authors.id == book_id).first().name + name = (db.session.query(db.Authors).filter(db.Authors.id == book_id).first().name).replace('|',',') author_info = None other_books = [] @@ -2740,7 +2742,7 @@ def edit_book(book_id): except Exception: book.languages[index].language_name = _(isoLanguages.get(part3=book.languages[index].lang_code).name) for author in book.authors: - author_names.append(author.name) + author_names.append(author.name.replace('|',',')) # Show form if request.method != 'POST': @@ -2783,7 +2785,7 @@ def edit_book(book_id): book.title = to_save["book_title"] edited_books_id.add(book.id) input_authors = to_save["author_name"].split('&') - input_authors = map(lambda it: it.strip(), input_authors) + input_authors = map(lambda it: it.strip().replace(',','|'), input_authors) # we have all author names now if input_authors == ['']: input_authors = [_(u'unknown')] # prevent empty Author