From a1ca2404f97d5fc334bc0fc2a3c03c0046307dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 16 Mar 2023 18:37:00 +0100 Subject: [PATCH] add 'globals' instead of overwriting the default (#3773) --- docs/configuration.rst | 14 ++++++-------- gallery_dl/__init__.py | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index fbb0416b..190e8981 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -4740,15 +4740,13 @@ Type Example * ``"~/.local/share/gdl-globals.py"`` * ``"gdl-globals"`` -Default - The ``GLOBALS`` dict in - `util.py <../gallery_dl/util.py>`__ Description - Path to or name of an - `importable `__ - Python module whose namespace gets used as an alternative - |globals parameter|__ - for compiled Python expressions. + | Path to or name of an + `importable `__ + Python module, + | whose namespace, + in addition to the ``GLOBALS`` dict in `util.py <../gallery_dl/util.py>`__, + gets used as |globals parameter|__ for compiled Python expressions. .. |globals parameter| replace:: ``globals`` parameter .. __: https://docs.python.org/3/library/functions.html#eval diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index 116ca5dd..a430f131 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -120,7 +120,7 @@ def main(): # eval globals path = config.get((), "globals") if path: - util.GLOBALS = util.import_file(path).__dict__ + util.GLOBALS.update(util.import_file(path).__dict__) # loglevels output.configure_logging(args.loglevel)