mirror of
https://github.com/JonathanHerrewijnen/calibre-web.git
synced 2024-11-10 21:24:15 +00:00
Improved testability
Less content exposed with restricted content Tornado restart and stop working with systemd
This commit is contained in:
parent
726595e117
commit
8b1444ebc2
@ -723,7 +723,8 @@ def tags_filters():
|
|||||||
# Creates for all stored languages a translated speaking name in the array for the UI
|
# Creates for all stored languages a translated speaking name in the array for the UI
|
||||||
def speaking_language(languages=None):
|
def speaking_language(languages=None):
|
||||||
if not languages:
|
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:
|
for lang in languages:
|
||||||
try:
|
try:
|
||||||
cur_l = LC.parse(lang.lang_code)
|
cur_l = LC.parse(lang.lang_code)
|
||||||
|
@ -55,6 +55,7 @@ class WebServer(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
signal.signal(signal.SIGINT, self._killServer)
|
signal.signal(signal.SIGINT, self._killServer)
|
||||||
signal.signal(signal.SIGTERM, self._killServer)
|
signal.signal(signal.SIGTERM, self._killServer)
|
||||||
|
signal.signal(signal.SIGQUIT, self._killServer)
|
||||||
|
|
||||||
self.wsgiserver = None
|
self.wsgiserver = None
|
||||||
self.access_logger = None
|
self.access_logger = None
|
||||||
@ -156,7 +157,7 @@ class WebServer(object):
|
|||||||
max_buffer_size=209700000,
|
max_buffer_size=209700000,
|
||||||
ssl_options=self.ssl_args)
|
ssl_options=self.ssl_args)
|
||||||
http_server.listen(self.listen_port, self.listen_address)
|
http_server.listen(self.listen_port, self.listen_address)
|
||||||
self.wsgiserver = IOLoop.instance()
|
self.wsgiserver = IOLoop.current()
|
||||||
self.wsgiserver.start()
|
self.wsgiserver.start()
|
||||||
# wait for stop signal
|
# wait for stop signal
|
||||||
self.wsgiserver.close(True)
|
self.wsgiserver.close(True)
|
||||||
@ -197,4 +198,4 @@ class WebServer(object):
|
|||||||
if _GEVENT:
|
if _GEVENT:
|
||||||
self.wsgiserver.close()
|
self.wsgiserver.close()
|
||||||
else:
|
else:
|
||||||
self.wsgiserver.add_callback(self.wsgiserver.stop)
|
self.wsgiserver.add_callback_from_signal(self.wsgiserver.stop)
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<label for="query" class="sr-only">{{_('Search')}}</label>
|
<label for="query" class="sr-only">{{_('Search')}}</label>
|
||||||
<input type="text" class="form-control" id="query" name="query" placeholder="{{_('Search')}}">
|
<input type="text" class="form-control" id="query" name="query" placeholder="{{_('Search')}}">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button type="submit" class="btn btn-default">{{_('Go!')}}</button>
|
<button type="submit" id="query_submit" class="btn btn-default">{{_('Go!')}}</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
{% if g.user.is_authenticated or g.allow_anonymous %}
|
{% if g.user.is_authenticated or g.allow_anonymous %}
|
||||||
<ul class="nav navbar-nav ">
|
<ul class="nav navbar-nav ">
|
||||||
<li><a href="{{url_for('web.advanced_search')}}"><span class="glyphicon glyphicon-search"></span><span class="hidden-sm">{{_('Advanced Search')}}</span></a></li>
|
<li><a href="{{url_for('web.advanced_search')}}" id="advanced_search"><span class="glyphicon glyphicon-search"></span><span class="hidden-sm">{{_('Advanced Search')}}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<ul class="nav navbar-nav navbar-right" id="main-nav">
|
<ul class="nav navbar-nav navbar-right" id="main-nav">
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
|
<button type="submit" id="adv_submit" class="btn btn-default">{{_('Submit')}}</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
10
cps/web.py
10
cps/web.py
@ -962,11 +962,13 @@ def advanced_search():
|
|||||||
return render_title_template('search.html', searchterm=searchterm,
|
return render_title_template('search.html', searchterm=searchterm,
|
||||||
entries=q, title=_(u"search"), page="search")
|
entries=q, title=_(u"search"), page="search")
|
||||||
# prepare data for search-form
|
# prepare data for search-form
|
||||||
# tags = db.session.query(db.Tags).order_by(db.Tags.name).all()
|
tags = db.session.query(db.Tags).join(db.books_tags_link).join(db.Books).filter(common_filters())\
|
||||||
tags = db.session.query(db.Tags).filter(tags_filters()).order_by(db.Tags.name).all()
|
.group_by(text('books_tags_link.tag')).order_by(db.Tags.name).all()
|
||||||
series = db.session.query(db.Series).order_by(db.Series.name).all()
|
series = db.session.query(db.Series).join(db.books_series_link).join(db.Books).filter(common_filters())\
|
||||||
extensions = db.session.query(db.Data) \
|
.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()
|
.group_by(db.Data.format).order_by(db.Data.format).all()
|
||||||
|
|
||||||
if current_user.filter_language() == u"all":
|
if current_user.filter_language() == u"all":
|
||||||
languages = speaking_language()
|
languages = speaking_language()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user