Improved testability

Less content exposed with restricted content
Tornado restart and stop working with systemd
pull/1179/head
Ozzieisaacs 5 years ago
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
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)

@ -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)

@ -44,7 +44,7 @@
<label for="query" class="sr-only">{{_('Search')}}</label>
<input type="text" class="form-control" id="query" name="query" placeholder="{{_('Search')}}">
<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>
</div>
</form>
@ -52,7 +52,7 @@
<div class="navbar-collapse collapse">
{% if g.user.is_authenticated or g.allow_anonymous %}
<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>
{% endif %}
<ul class="nav navbar-nav navbar-right" id="main-nav">

@ -167,7 +167,7 @@
{% endfor %}
{% endif %}
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
<button type="submit" id="adv_submit" class="btn btn-default">{{_('Submit')}}</button>
</form>
</div>
{% endblock %}

@ -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:

Loading…
Cancel
Save