Move core utility functions into a separate module
authorKarl O. Pinc <kop@karlpinc.com>
Tue, 16 Jul 2024 22:18:46 +0000 (17:18 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Tue, 16 Jul 2024 22:18:46 +0000 (17:18 -0500)
src/pgwui_copy/views/copy.py

index 2f2941492b704d88c6c3fa5d05d299111da6433e..7978e831e3641b523cd74ef5ababac2797c151b9 100644 (file)
@@ -34,6 +34,7 @@ from wtforms import (
 
 from pyramid.view import view_config
 
+import pgwui_core.utils
 from pgwui_core.core import (
     UploadEngine,
     NoTransactionEngine,
@@ -45,7 +46,6 @@ from pgwui_core.core import (
     SQLData,
     NoOpProcessor,
     ExecuteSQL,
-    format_exception,
 )
 
 from pgwui_core.exceptions import AuthFailError
@@ -230,8 +230,8 @@ class CopySchemaHandler(SessionDBHandler):
 
     def log_sql_failure(self, msg, ex):
         '''Write a failture message to the log when executing sql.'''
-        log.info('{0}: {1}{2}'
-                 .format(msg, self.to_db_detail(), format_exception(ex)))
+        log.info(f'{msg}: {self.to_db_detail()}'
+                 f'{pgwui_core.utils.format_exception(ex)}')
 
 
 @attr.s