]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
add conditional for fileConfig()
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 7 Feb 2022 19:52:03 +0000 (14:52 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 7 Feb 2022 19:52:03 +0000 (14:52 -0500)
The ``fileConfig()`` line in the ``env.py`` templates is now conditional on
``Config.config_file_name`` not being None.

Change-Id: Ibe943d093fd872c4d0a836f58e0608a4e078ce1f
Fixes: #986
alembic/templates/async/env.py
alembic/templates/generic/env.py
alembic/templates/multidb/env.py
alembic/templates/pylons/env.py
docs/build/unreleased/986.rst [new file with mode: 0644]

index 4ac2b6ac36cf6ef21a08419d2dd77216656e3cd6..61030dcf6b229768456da93f15be0e6b03f35b19 100644 (file)
@@ -13,7 +13,8 @@ config = context.config
 
 # Interpret the config file for Python logging.
 # This line sets up loggers basically.
-fileConfig(config.config_file_name)
+if config.config_file_name is not None:
+    fileConfig(config.config_file_name)
 
 # add your model's MetaData object here
 # for 'autogenerate' support
index 70518a2eef734a8fffcd787cfa397309469f8e76..edeff1d5f4f97f71b639fadbb298467a273d2203 100644 (file)
@@ -11,7 +11,8 @@ config = context.config
 
 # Interpret the config file for Python logging.
 # This line sets up loggers basically.
-fileConfig(config.config_file_name)
+if config.config_file_name is not None:
+    fileConfig(config.config_file_name)
 
 # add your model's MetaData object here
 # for 'autogenerate' support
index f1a9a9ad3e7672821e82e6b28c297ebcde5da41a..687f584313a8cd7d29e44ee413b007ec92113fdd 100644 (file)
@@ -15,7 +15,8 @@ config = context.config
 
 # Interpret the config file for Python logging.
 # This line sets up loggers basically.
-fileConfig(config.config_file_name)
+if config.config_file_name is not None:
+    fileConfig(config.config_file_name)
 logger = logging.getLogger("alembic.env")
 
 # gather section names referring to different
index b2d610d707536f43dddbe4e19156b935480243e4..18d47c8547cf9c30e5dfbf034e60813353bddeee 100644 (file)
@@ -21,7 +21,8 @@ except:
     # can use config['__file__'] here, i.e. the Pylons
     # ini file, instead of alembic.ini
     config_file = config.get_main_option("pylons_config_file")
-    fileConfig(config_file)
+    if config_file is not None:
+        fileConfig(config_file)
     wsgi_app = loadapp("config:%s" % config_file, relative_to=".")
 
 
diff --git a/docs/build/unreleased/986.rst b/docs/build/unreleased/986.rst
new file mode 100644 (file)
index 0000000..6834d9d
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, environment
+    :tickets: 986
+
+    The ``fileConfig()`` line in the ``env.py`` templates is now conditional on
+    ``Config.config_file_name`` not being None.
+