mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-10-31 15:23:02 +00:00 
			
		
		
		
	Updates dependencies
Update logger ->filename is logged instead of responsible logger
This commit is contained in:
		| @@ -29,7 +29,7 @@ from .constants import CONFIG_DIR as _CONFIG_DIR | |||||||
| ACCESS_FORMATTER_GEVENT  = Formatter("%(message)s") | ACCESS_FORMATTER_GEVENT  = Formatter("%(message)s") | ||||||
| ACCESS_FORMATTER_TORNADO = Formatter("[%(asctime)s] %(message)s") | ACCESS_FORMATTER_TORNADO = Formatter("[%(asctime)s] %(message)s") | ||||||
|  |  | ||||||
| FORMATTER           = Formatter("[%(asctime)s] %(levelname)5s {%(name)s:%(lineno)d} %(message)s") | FORMATTER           = Formatter("[%(asctime)s] %(levelname)5s {%(filename)s:%(lineno)d} %(message)s") | ||||||
| DEFAULT_LOG_LEVEL   = logging.INFO | DEFAULT_LOG_LEVEL   = logging.INFO | ||||||
| DEFAULT_LOG_FILE    = os.path.join(_CONFIG_DIR, "calibre-web.log") | DEFAULT_LOG_FILE    = os.path.join(_CONFIG_DIR, "calibre-web.log") | ||||||
| DEFAULT_ACCESS_LOG  = os.path.join(_CONFIG_DIR, "access.log") | DEFAULT_ACCESS_LOG  = os.path.join(_CONFIG_DIR, "access.log") | ||||||
| @@ -42,18 +42,12 @@ logging.addLevelName(logging.CRITICAL, "CRIT") | |||||||
|  |  | ||||||
| class _Logger(logging.Logger): | class _Logger(logging.Logger): | ||||||
|  |  | ||||||
|     def error_or_exception(self, message, stacklevel=2, *args, **kwargs): |     def error_or_exception(self, message, stacklevel=1, *args, **kwargs): | ||||||
|         is_debug = self.getEffectiveLevel() <= logging.DEBUG |         is_debug = self.getEffectiveLevel() <= logging.DEBUG | ||||||
|         if sys.version_info > (3, 7): |         if not is_debug: | ||||||
|             if is_debug: |  | ||||||
|             self.exception(message, stacklevel=stacklevel, *args, **kwargs) |             self.exception(message, stacklevel=stacklevel, *args, **kwargs) | ||||||
|         else: |         else: | ||||||
|             self.error(message, stacklevel=stacklevel, *args, **kwargs) |             self.error(message, stacklevel=stacklevel, *args, **kwargs) | ||||||
|         else: |  | ||||||
|             if is_debug: |  | ||||||
|                 self.exception(message, stack_info=True, *args, **kwargs) |  | ||||||
|             else: |  | ||||||
|                 self.error(message, *args, **kwargs) |  | ||||||
|  |  | ||||||
|     def debug_no_auth(self, message, *args, **kwargs): |     def debug_no_auth(self, message, *args, **kwargs): | ||||||
|         message = message.strip("\r\n") |         message = message.strip("\r\n") | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ from cps.embed_helper import do_calibre_export | |||||||
| from cps import logger, config | from cps import logger, config | ||||||
| from cps import gdriveutils | from cps import gdriveutils | ||||||
| from cps.string_helper import strip_whitespaces | from cps.string_helper import strip_whitespaces | ||||||
| import uuid |  | ||||||
|  |  | ||||||
| log = logger.create() | log = logger.create() | ||||||
|  |  | ||||||
| @@ -56,7 +56,7 @@ class EmailBase: | |||||||
|  |  | ||||||
|     def send(self, strg): |     def send(self, strg): | ||||||
|         """Send `strg' to the server.""" |         """Send `strg' to the server.""" | ||||||
|         log.debug_no_auth('send: {}'.format(strg[:300])) |         log.debug_no_auth('send: {}'.format(strg[:300]), stacklevel=2) | ||||||
|         if hasattr(self, 'sock') and self.sock: |         if hasattr(self, 'sock') and self.sock: | ||||||
|             try: |             try: | ||||||
|                 if self.transferSize: |                 if self.transferSize: | ||||||
| @@ -169,14 +169,14 @@ class TaskEmail(CalibreTask): | |||||||
|             else: |             else: | ||||||
|                 self.send_gmail_email(msg) |                 self.send_gmail_email(msg) | ||||||
|         except MemoryError as e: |         except MemoryError as e: | ||||||
|             log.error_or_exception(e, stacklevel=3) |             log.error_or_exception(e, stacklevel=2) | ||||||
|             self._handleError('MemoryError sending e-mail: {}'.format(str(e))) |             self._handleError('MemoryError sending e-mail: {}'.format(str(e))) | ||||||
|         except (smtplib.SMTPRecipientsRefused) as e: |         except (smtplib.SMTPRecipientsRefused) as e: | ||||||
|             log.error_or_exception(e, stacklevel=3) |             log.error_or_exception(e, stacklevel=2) | ||||||
|             self._handleError('Smtplib Error sending e-mail: {}'.format( |             self._handleError('Smtplib Error sending e-mail: {}'.format( | ||||||
|                 (list(e.args[0].values())[0][1]).decode('utf-8)').replace("\n", '. '))) |                 (list(e.args[0].values())[0][1]).decode('utf-8)').replace("\n", '. '))) | ||||||
|         except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e: |         except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e: | ||||||
|             log.error_or_exception(e, stacklevel=3) |             log.error_or_exception(e, stacklevel=2) | ||||||
|             if hasattr(e, "smtp_error"): |             if hasattr(e, "smtp_error"): | ||||||
|                 text = e.smtp_error.decode('utf-8').replace("\n", '. ') |                 text = e.smtp_error.decode('utf-8').replace("\n", '. ') | ||||||
|             elif hasattr(e, "message"): |             elif hasattr(e, "message"): | ||||||
| @@ -187,10 +187,10 @@ class TaskEmail(CalibreTask): | |||||||
|                 text = '' |                 text = '' | ||||||
|             self._handleError('Smtplib Error sending e-mail: {}'.format(text)) |             self._handleError('Smtplib Error sending e-mail: {}'.format(text)) | ||||||
|         except (socket.error) as e: |         except (socket.error) as e: | ||||||
|             log.error_or_exception(e, stacklevel=3) |             log.error_or_exception(e, stacklevel=2) | ||||||
|             self._handleError('Socket Error sending e-mail: {}'.format(e.strerror)) |             self._handleError('Socket Error sending e-mail: {}'.format(e.strerror)) | ||||||
|         except Exception as ex: |         except Exception as ex: | ||||||
|             log.error_or_exception(ex, stacklevel=3) |             log.error_or_exception(ex, stacklevel=2) | ||||||
|             self._handleError('Error sending e-mail: {}'.format(ex)) |             self._handleError('Error sending e-mail: {}'.format(ex)) | ||||||
|  |  | ||||||
|     def send_standard_email(self, msg): |     def send_standard_email(self, msg): | ||||||
| @@ -273,7 +273,7 @@ class TaskEmail(CalibreTask): | |||||||
|                 if config.config_binariesdir and config.config_embed_metadata: |                 if config.config_binariesdir and config.config_embed_metadata: | ||||||
|                     os.remove(datafile) |                     os.remove(datafile) | ||||||
|             except IOError as e: |             except IOError as e: | ||||||
|                 log.error_or_exception(e, stacklevel=3) |                 log.error_or_exception(e, stacklevel=2) | ||||||
|                 log.error('The requested file could not be read. Maybe wrong permissions?') |                 log.error('The requested file could not be read. Maybe wrong permissions?') | ||||||
|                 return None |                 return None | ||||||
|         return data |         return data | ||||||
|   | |||||||
| @@ -60,7 +60,7 @@ from .services.worker import WorkerThread | |||||||
| from .tasks_status import render_task_status | from .tasks_status import render_task_status | ||||||
| from .usermanagement import user_login_required | from .usermanagement import user_login_required | ||||||
| from .string_helper import strip_whitespaces | from .string_helper import strip_whitespaces | ||||||
|  | import traceback | ||||||
|  |  | ||||||
| feature_support = { | feature_support = { | ||||||
|     'ldap': bool(services.ldap), |     'ldap': bool(services.ldap), | ||||||
| @@ -808,6 +808,10 @@ def render_archived_books(page, sort_param): | |||||||
| @web.route('/page/<int:page>') | @web.route('/page/<int:page>') | ||||||
| @login_required_if_no_ano | @login_required_if_no_ano | ||||||
| def index(page): | def index(page): | ||||||
|  |     try: | ||||||
|  |         x = 7/0 | ||||||
|  |     except Exception: | ||||||
|  |         log.error("test", stacklevel=1) | ||||||
|     sort_param = (request.args.get('sort') or 'stored').lower() |     sort_param = (request.args.get('sort') or 'stored').lower() | ||||||
|     return render_books_list("newest", sort_param, 1, page) |     return render_books_list("newest", sort_param, 1, page) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,11 +1,11 @@ | |||||||
| # GDrive Integration | # GDrive Integration | ||||||
| google-api-python-client>=1.7.11,<2.200.0 | google-api-python-client>=1.7.11,<2.200.0 | ||||||
| gevent>20.6.0,<24.3.0 | gevent>20.6.0,<24.12.0 | ||||||
| greenlet>=0.4.17,<3.2.0 | greenlet>=0.4.17,<3.2.0 | ||||||
| httplib2>=0.9.2,<0.23.0 | httplib2>=0.9.2,<0.23.0 | ||||||
| oauth2client>=4.0.0,<4.1.4 | oauth2client>=4.0.0,<4.1.4 | ||||||
| uritemplate>=3.0.0,<4.2.0 | uritemplate>=3.0.0,<4.2.0 | ||||||
| pyasn1-modules>=0.0.8,<0.5.0 | pyasn1-modules>=0.0.8,<0.7.0 | ||||||
| pyasn1>=0.1.9,<0.7.0 | pyasn1>=0.1.9,<0.7.0 | ||||||
| PyDrive2>=1.3.1,<1.22.0 | PyDrive2>=1.3.1,<1.22.0 | ||||||
| PyYAML>=3.12,<6.1 | PyYAML>=3.12,<6.1 | ||||||
| @@ -17,23 +17,23 @@ google-api-python-client>=1.7.11,<2.200.0 | |||||||
|  |  | ||||||
| # goodreads | # goodreads | ||||||
| goodreads>=0.3.2,<0.4.0 | goodreads>=0.3.2,<0.4.0 | ||||||
| python-Levenshtein>=0.12.0,<0.27.0 | python-Levenshtein>=0.12.0,<0.28.0 | ||||||
|  |  | ||||||
| # ldap login | # ldap login | ||||||
| python-ldap>=3.0.0,<3.5.0 | python-ldap>=3.0.0,<3.5.0 | ||||||
| Flask-SimpleLDAP>=1.4.0,<2.1.0 | Flask-SimpleLDAP>=1.4.0,<2.1.0 | ||||||
|  |  | ||||||
| # oauth | # oauth | ||||||
| Flask-Dance>=2.0.0,<7.1.0 | Flask-Dance>=2.0.0,<7.2.0 | ||||||
| SQLAlchemy-Utils>=0.33.5,<0.42.0 | SQLAlchemy-Utils>=0.33.5,<0.42.0 | ||||||
|  |  | ||||||
| # metadata extraction | # metadata extraction | ||||||
| rarfile>=3.2,<5.0 | rarfile>=3.2,<5.0 | ||||||
| scholarly>=1.2.0,<1.8 | scholarly>=1.2.0,<1.8 | ||||||
| markdown2>=2.0.0,<2.5.0 | markdown2>=2.0.0,<2.6.0 | ||||||
| html2text>=2020.1.16,<2024.2.26 | html2text>=2020.1.16,<2025.2.26 | ||||||
| python-dateutil>=2.1,<2.10.0 | python-dateutil>=2.1,<2.10.0 | ||||||
| beautifulsoup4>=4.0.1,<4.13.0 | beautifulsoup4>=4.0.1,<4.14.0 | ||||||
| faust-cchardet>=2.1.18,<2.1.20 | faust-cchardet>=2.1.18,<2.1.20 | ||||||
| py7zr>=0.15.0,<0.21.0 | py7zr>=0.15.0,<0.21.0 | ||||||
| mutagen>=1.40.0,<1.50.0 | mutagen>=1.40.0,<1.50.0 | ||||||
|   | |||||||
| @@ -12,12 +12,11 @@ classifiers = [ | |||||||
|     "Development Status :: 5 - Production/Stable", |     "Development Status :: 5 - Production/Stable", | ||||||
|     "License :: OSI Approved :: GNU Affero General Public License v3", |     "License :: OSI Approved :: GNU Affero General Public License v3", | ||||||
|     "Programming Language :: Python :: 3", |     "Programming Language :: Python :: 3", | ||||||
|     "Programming Language :: Python :: 3.6", |  | ||||||
|     "Programming Language :: Python :: 3.7", |  | ||||||
|     "Programming Language :: Python :: 3.8", |     "Programming Language :: Python :: 3.8", | ||||||
|     "Programming Language :: Python :: 3.9", |     "Programming Language :: Python :: 3.9", | ||||||
|     "Programming Language :: Python :: 3.10", |     "Programming Language :: Python :: 3.10", | ||||||
|     "Programming Language :: Python :: 3.11", |     "Programming Language :: Python :: 3.11", | ||||||
|  |     "Programming Language :: Python :: 3.12", | ||||||
|     "Operating System :: OS Independent", |     "Operating System :: OS Independent", | ||||||
| ] | ] | ||||||
| keywords = [ | keywords = [ | ||||||
|   | |||||||
| @@ -1,26 +1,26 @@ | |||||||
| APScheduler>=3.6.3,<3.11.0 | APScheduler>=3.6.3,<3.12.0 | ||||||
| Babel>=1.3,<3.0 | Babel>=1.3,<3.0 | ||||||
| Flask-Babel>=3.0.0,<4.1.0 | Flask-Babel>=3.0.0,<4.1.0 | ||||||
| Flask-Principal>=0.3.2,<0.5.1 | Flask-Principal>=0.3.2,<0.5.1 | ||||||
| Flask>=1.0.2,<3.1.0 | Flask>=1.0.2,<3.2.0 | ||||||
| iso-639>=0.4.5,<0.5.0;python_version<'3.12' | iso-639>=0.4.5,<0.5.0;python_version<'3.12' | ||||||
| pycountry>=20.0.0,<25.0.0;python_version>='3.12' | pycountry>=20.0.0,<25.0.0;python_version>='3.12' | ||||||
| PyPDF>=3.15.6,<5.1.0 | PyPDF>=3.15.6,<5.5.0 | ||||||
| pytz>=2016.10 | pytz>=2016.10 | ||||||
| requests>=2.32.0,<2.33.0 | requests>=2.32.0,<2.33.0 | ||||||
| SQLAlchemy>=1.3.0,<2.1.0 | SQLAlchemy>=1.3.0,<2.1.0 | ||||||
| tornado>=6.3,<6.5 | tornado>=6.4.2,<6.6 | ||||||
| Wand>=0.4.4,<0.7.0 | Wand>=0.4.4,<0.7.0 | ||||||
| unidecode>=0.04.19,<1.4.0 | unidecode>=0.04.19,<1.4.0 | ||||||
| lxml>=4.9.1,<5.3.0 | lxml>=4.9.1,<5.4.0 | ||||||
| flask-wtf>=0.14.2,<1.3.0 | flask-wtf>=0.14.2,<1.3.0 | ||||||
| chardet>=3.0.0,<5.3.0 | chardet>=3.0.0,<5.3.0 | ||||||
| netifaces-plus>=0.12.0,<0.13.0 | netifaces-plus>=0.12.0,<0.13.0 | ||||||
| urllib3>=1.22,<3.0 | urllib3>=1.22,<3.0 | ||||||
| Flask-Limiter>=2.3.0,<3.9.0 | Flask-Limiter>=2.3.0,<3.13.0 | ||||||
| regex>=2022.3.2,<2024.6.25 | regex>=2022.3.2,<2025.3.20 | ||||||
| bleach>=6.0.0,<6.2.0 | bleach>=6.0.0,<6.2.0 | ||||||
| python-magic>=0.4.27,<0.5.0 | python-magic>=0.4.27,<0.5.0 | ||||||
| python-magic-bin>=0.4.0,<0.5.0;sys_platform=='win32' | python-magic-bin>=0.4.0,<0.5.0;sys_platform=='win32' | ||||||
| flask-httpAuth>=4.4.0,<5.0.0 | flask-httpAuth>=4.4.0,<5.0.0 | ||||||
| cryptography>=30.0.0,<44.0.0 | cryptography>=43.0.4,<45.0.0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ozzie Isaacs
					Ozzie Isaacs