|
|
@ -172,7 +172,12 @@ cache_buster.init_cache_busting(app)
|
|
|
|
|
|
|
|
|
|
|
|
formatter = logging.Formatter(
|
|
|
|
formatter = logging.Formatter(
|
|
|
|
"[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
|
|
|
|
"[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
|
|
|
|
file_handler = RotatingFileHandler(config.get_config_logfile(), maxBytes=50000, backupCount=2)
|
|
|
|
try:
|
|
|
|
|
|
|
|
file_handler = RotatingFileHandler(config.get_config_logfile(), maxBytes=50000, backupCount=2)
|
|
|
|
|
|
|
|
except IOError:
|
|
|
|
|
|
|
|
file_handler = RotatingFileHandler(os.path.join(config.get_main_dir, "calibre-web.log"),
|
|
|
|
|
|
|
|
maxBytes=50000, backupCount=2)
|
|
|
|
|
|
|
|
# ToDo: reset logfile value in config class
|
|
|
|
file_handler.setFormatter(formatter)
|
|
|
|
file_handler.setFormatter(formatter)
|
|
|
|
app.logger.addHandler(file_handler)
|
|
|
|
app.logger.addHandler(file_handler)
|
|
|
|
app.logger.setLevel(config.config_log_level)
|
|
|
|
app.logger.setLevel(config.config_log_level)
|
|
|
@ -207,7 +212,8 @@ def get_locale():
|
|
|
|
# if a user is logged in, use the locale from the user settings
|
|
|
|
# if a user is logged in, use the locale from the user settings
|
|
|
|
user = getattr(g, 'user', None)
|
|
|
|
user = getattr(g, 'user', None)
|
|
|
|
if user is not None and hasattr(user, "locale"):
|
|
|
|
if user is not None and hasattr(user, "locale"):
|
|
|
|
return user.locale
|
|
|
|
if user.nickname != 'Guest': # if the account is the guest account bypass the config lang settings
|
|
|
|
|
|
|
|
return user.locale
|
|
|
|
translations = [item.language for item in babel.list_translations()] + ['en']
|
|
|
|
translations = [item.language for item in babel.list_translations()] + ['en']
|
|
|
|
preferred = [x.replace('-', '_') for x in request.accept_languages.values()]
|
|
|
|
preferred = [x.replace('-', '_') for x in request.accept_languages.values()]
|
|
|
|
return negotiate_locale(preferred, translations)
|
|
|
|
return negotiate_locale(preferred, translations)
|
|
|
@ -3573,10 +3579,10 @@ def edit_book(book_id):
|
|
|
|
# Update book
|
|
|
|
# Update book
|
|
|
|
edited_books_id = None
|
|
|
|
edited_books_id = None
|
|
|
|
#handle book title
|
|
|
|
#handle book title
|
|
|
|
if book.title != to_save["book_title"]:
|
|
|
|
if book.title != to_save["book_title"].rstrip().strip():
|
|
|
|
if to_save["book_title"] == '':
|
|
|
|
if to_save["book_title"] == '':
|
|
|
|
to_save["book_title"] = _(u'unknown')
|
|
|
|
to_save["book_title"] = _(u'unknown')
|
|
|
|
book.title = to_save["book_title"]
|
|
|
|
book.title = to_save["book_title"].rstrip().strip()
|
|
|
|
edited_books_id = book.id
|
|
|
|
edited_books_id = book.id
|
|
|
|
|
|
|
|
|
|
|
|
# handle author(s)
|
|
|
|
# handle author(s)
|
|
|
@ -3601,8 +3607,6 @@ def edit_book(book_id):
|
|
|
|
error = False
|
|
|
|
error = False
|
|
|
|
if edited_books_id:
|
|
|
|
if edited_books_id:
|
|
|
|
error = helper.update_dir_stucture(edited_books_id, config.config_calibre_dir)
|
|
|
|
error = helper.update_dir_stucture(edited_books_id, config.config_calibre_dir)
|
|
|
|
if error: # stop on error
|
|
|
|
|
|
|
|
flash(error, category="error")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not error:
|
|
|
|
if not error:
|
|
|
|
if to_save["cover_url"]:
|
|
|
|
if to_save["cover_url"]:
|
|
|
|