diff --git a/cps/helper.py b/cps/helper.py index ec5628b3..d446630b 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -723,7 +723,8 @@ def tags_filters(): # Creates for all stored languages a translated speaking name in the array for the UI def speaking_language(languages=None): if not languages: - languages = db.session.query(db.Languages).all() + languages = db.session.query(db.Languages).join(db.books_languages_link).join(db.Books).filter(common_filters())\ + .group_by(text('books_languages_link.lang_code')).all() for lang in languages: try: cur_l = LC.parse(lang.lang_code) diff --git a/cps/server.py b/cps/server.py index 8f060719..17422f35 100755 --- a/cps/server.py +++ b/cps/server.py @@ -55,6 +55,7 @@ class WebServer(object): def __init__(self): signal.signal(signal.SIGINT, self._killServer) signal.signal(signal.SIGTERM, self._killServer) + signal.signal(signal.SIGQUIT, self._killServer) self.wsgiserver = None self.access_logger = None @@ -156,7 +157,7 @@ class WebServer(object): max_buffer_size=209700000, ssl_options=self.ssl_args) http_server.listen(self.listen_port, self.listen_address) - self.wsgiserver = IOLoop.instance() + self.wsgiserver = IOLoop.current() self.wsgiserver.start() # wait for stop signal self.wsgiserver.close(True) @@ -197,4 +198,4 @@ class WebServer(object): if _GEVENT: self.wsgiserver.close() else: - self.wsgiserver.add_callback(self.wsgiserver.stop) + self.wsgiserver.add_callback_from_signal(self.wsgiserver.stop) diff --git a/cps/templates/layout.html b/cps/templates/layout.html index fc0009f9..07a9b5b6 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -44,7 +44,7 @@ - + @@ -52,7 +52,7 @@
{% endblock %} diff --git a/cps/web.py b/cps/web.py index 848ee9b3..9cb2f808 100644 --- a/cps/web.py +++ b/cps/web.py @@ -962,11 +962,13 @@ def advanced_search(): return render_title_template('search.html', searchterm=searchterm, entries=q, title=_(u"search"), page="search") # prepare data for search-form - # tags = db.session.query(db.Tags).order_by(db.Tags.name).all() - tags = db.session.query(db.Tags).filter(tags_filters()).order_by(db.Tags.name).all() - series = db.session.query(db.Series).order_by(db.Series.name).all() - extensions = db.session.query(db.Data) \ + tags = db.session.query(db.Tags).join(db.books_tags_link).join(db.Books).filter(common_filters())\ + .group_by(text('books_tags_link.tag')).order_by(db.Tags.name).all() + series = db.session.query(db.Series).join(db.books_series_link).join(db.Books).filter(common_filters())\ + .group_by(text('books_series_link.series')).order_by(db.Series.name).filter(common_filters()).all() + extensions = db.session.query(db.Data).join(db.Books).filter(common_filters())\ .group_by(db.Data.format).order_by(db.Data.format).all() + if current_user.filter_language() == u"all": languages = speaking_language() else: