diff --git a/cps/cli.py b/cps/cli.py index 5e172626..7f8d9ab3 100644 --- a/cps/cli.py +++ b/cps/cli.py @@ -44,5 +44,9 @@ if args.k: print("Keyfilepath is invalid. Exiting...") sys.exit(1) +if (args.k and not args.c) or (not args.k and args.c): + print("Certfile and Keyfile have to be used together. Exiting...") + sys.exit(1) + if args.k is "": keyfilepath = "" diff --git a/cps/server.py b/cps/server.py index 37245b42..bf1c1923 100644 --- a/cps/server.py +++ b/cps/server.py @@ -5,6 +5,8 @@ from socket import error as SocketError import sys import os +import signal + try: from gevent.pywsgi import WSGIServer from gevent.pool import Pool @@ -26,7 +28,8 @@ class server: restart= False def __init__(self): - pass + signal.signal(signal.SIGINT, self.killServer) + signal.signal(signal.SIGTERM, self.killServer) def start_gevent(self): try: @@ -86,6 +89,9 @@ class server: def setRestartTyp(self,starttyp): self.restart=starttyp + def killServer(self, signum, frame): + self.stopServer() + def stopServer(self): if gevent_present: self.wsgiserver.close() diff --git a/cps/templates/admin.html b/cps/templates/admin.html index 767bdd41..b7d23db1 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -96,8 +96,8 @@
{% if config.config_remote_login %}{% else %}{% endif %}
-
{{_('Basic Configuration')}}
-
{{_('UI Configuration')}}
+
{{_('Basic Configuration')}}
+
{{_('UI Configuration')}}
@@ -105,8 +105,8 @@

{{_('Administration')}}

{{_('Reconnect to Calibre DB')}}
-
{{_('Restart Calibre-Web')}}
-
{{_('Stop Calibre-Web')}}
+
{{_('Restart Calibre-Web')}}
+
{{_('Stop Calibre-Web')}}
diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html index 00f78176..b2826b39 100644 --- a/cps/templates/config_edit.html +++ b/cps/templates/config_edit.html @@ -207,12 +207,12 @@
- + {% if not origin %} {{_('Back')}} {% endif %} {% if success %} - {{_('Login')}} + {{_('Login')}} {% endif %}
diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 3a7c5f6f..420b98a6 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -174,8 +174,10 @@ {% if entry.comments|length > 0 and entry.comments[0].text|length > 0%} -

{{_('Description:')}}

- {{entry.comments[0].text|safe}} +
+

{{_('Description:')}}

+ {{entry.comments[0].text|safe}} +
{% endif %} diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 634a3426..f821c08b 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -122,16 +122,16 @@ {%endif%} {% if g.user.show_sorted() %} - {%endif%} @@ -139,13 +139,13 @@ {%endif%} {% if g.user.show_best_rated_books() %} -
  • {{_('Best rated Books')}}
  • + {%endif%} {% if g.user.show_read_and_unread() %} {% if not g.user.is_anonymous %} -
  • {{_('Read Books')}}
  • + {%endif%} -
  • {{_('Unread Books')}}
  • + {%endif%} {% if g.user.show_random_books() %} diff --git a/cps/templates/register.html b/cps/templates/register.html index bad6c47d..70bd10c7 100644 --- a/cps/templates/register.html +++ b/cps/templates/register.html @@ -7,15 +7,11 @@ -
    - + {% if error %} diff --git a/cps/templates/shelf_edit.html b/cps/templates/shelf_edit.html index 454a7c41..e9bc1523 100644 --- a/cps/templates/shelf_edit.html +++ b/cps/templates/shelf_edit.html @@ -14,7 +14,7 @@ {% endif %} - + {% if shelf.id != None %} {{_('Back')}} {% endif %} diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index 5c6b308e..c3fccc40 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -22,8 +22,6 @@ {% endif %} - - {% endif %}
    diff --git a/cps/web.py b/cps/web.py index adf1807e..9b56b926 100644 --- a/cps/web.py +++ b/cps/web.py @@ -590,7 +590,7 @@ def modify_database_object(input_elements, db_book_object, db_object, db_session new_element = db_object(add_element, add_element) elif db_type == 'custom': new_element = db_object(value=add_element) - else: # db_type should be tag, languages, publisher + else: # db_type should be tag, language or publisher new_element = db_object(add_element) db_session.add(new_element) # add element to book @@ -3011,7 +3011,8 @@ def configuration_helper(origin): if content.config_logfile != to_save["config_logfile"]: # check valid path, only path or file if os.path.dirname(to_save["config_logfile"]): - if os.path.exists(os.path.dirname(to_save["config_logfile"])): + if os.path.exists(os.path.dirname(to_save["config_logfile"])) and \ + os.path.basename(to_save["config_logfile"]) and not os.path.isdir(to_save["config_logfile"]): content.config_logfile = to_save["config_logfile"] else: ub.session.commit() @@ -3059,8 +3060,6 @@ def configuration_helper(origin): gdriveError=gdriveError, goodreads=goodreads_support, rarfile_support=rar_support, title=_(u"Basic Configuration"), page="config") if reboot_required: - # ub.session.close() - # ub.engine.dispose() # stop Server server.Server.setRestartTyp(True) server.Server.stopServer() diff --git a/cps/worker.py b/cps/worker.py index 0eca51c1..02ca742f 100644 --- a/cps/worker.py +++ b/cps/worker.py @@ -487,6 +487,7 @@ class WorkerThread(threading.Thread): datetime.now() - self.queue[self.current]['starttime']) +# Enable logging of smtp lib debug output class StderrLogger(object): buffer = ''