diff options
| author | Michael Merickel <michael@merickel.org> | 2024-01-27 18:23:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-27 18:23:23 -0700 |
| commit | 55f9eb0bb0b72fe60ecde7529edbc27aceade187 (patch) | |
| tree | 1e34614ff9be1c59ad6a2ebb1f4e8bc2a17c6c1d /src | |
| parent | 19ae96b97ea055c2e36c8fb86819c426b37ab6af (diff) | |
| parent | fd42b0c8d08f69f88e3728b1c1ff3f50071f4b30 (diff) | |
| download | pyramid-55f9eb0bb0b72fe60ecde7529edbc27aceade187.tar.gz pyramid-55f9eb0bb0b72fe60ecde7529edbc27aceade187.tar.bz2 pyramid-55f9eb0bb0b72fe60ecde7529edbc27aceade187.zip | |
Merge pull request #3735 from adroullier/script_info
Adding script name to 'global_config' during application setup
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/paster.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/prequest.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/proutes.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/pserve.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/pshell.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/ptweens.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/pviews.py | 2 |
7 files changed, 14 insertions, 0 deletions
diff --git a/src/pyramid/paster.py b/src/pyramid/paster.py index f14acacf7..30e4f3e27 100644 --- a/src/pyramid/paster.py +++ b/src/pyramid/paster.py @@ -114,6 +114,8 @@ def bootstrap(config_uri, request=None, options=None): by the ``closer``. """ + options = dict(options or {}) + options.setdefault('__script__', 'bootstrap') app = get_app(config_uri, options=options) env = prepare(request) env['app'] = app diff --git a/src/pyramid/scripts/prequest.py b/src/pyramid/scripts/prequest.py index ab5e81dfc..c537ae677 100644 --- a/src/pyramid/scripts/prequest.py +++ b/src/pyramid/scripts/prequest.py @@ -45,6 +45,7 @@ class PRequestCommand: the request's WSGI environment, so your application can distinguish these calls from normal requests. """ + script_name = 'prequest' parser = argparse.ArgumentParser( description=textwrap.dedent(description), @@ -136,6 +137,7 @@ class PRequestCommand: return 2 config_uri = self.args.config_uri config_vars = parse_vars(self.args.config_vars) + config_vars.setdefault('__script__', self.script_name) path = self.args.path_info loader = self._get_config_loader(config_uri) diff --git a/src/pyramid/scripts/proutes.py b/src/pyramid/scripts/proutes.py index 9c54c06cc..9d419bd8b 100644 --- a/src/pyramid/scripts/proutes.py +++ b/src/pyramid/scripts/proutes.py @@ -224,6 +224,7 @@ class PRoutesCommand: will be assumed. Example: 'proutes myapp.ini'. """ + script_name = 'proutes' bootstrap = staticmethod(bootstrap) # testing get_config_loader = staticmethod(get_config_loader) # testing stdout = sys.stdout @@ -316,6 +317,7 @@ class PRoutesCommand: config_uri = self.args.config_uri config_vars = parse_vars(self.args.config_vars) + config_vars.setdefault('__script__', self.script_name) loader = self.get_config_loader(config_uri) loader.setup_logging(config_vars) self.proutes_file_config(loader, config_vars) diff --git a/src/pyramid/scripts/pserve.py b/src/pyramid/scripts/pserve.py index 8eb0ca52f..7504d9a1f 100644 --- a/src/pyramid/scripts/pserve.py +++ b/src/pyramid/scripts/pserve.py @@ -38,6 +38,7 @@ class PServeCommand: You can also include variable assignments like 'http_port=8080' and then use %(http_port)s in your config files. """ + script_name = 'pserve' default_verbosity = 1 parser = argparse.ArgumentParser( @@ -182,6 +183,7 @@ class PServeCommand: return 2 config_uri = self.args.config_uri config_vars = parse_vars(self.args.config_vars) + config_vars.setdefault('__script__', self.script_name) app_spec = self.args.config_uri app_name = self.args.app_name diff --git a/src/pyramid/scripts/pshell.py b/src/pyramid/scripts/pshell.py index f80509fa8..63600abaf 100644 --- a/src/pyramid/scripts/pshell.py +++ b/src/pyramid/scripts/pshell.py @@ -38,6 +38,7 @@ class PShellCommand: than one Pyramid application within it, the loader will use the last one. """ + script_name = 'pshell' bootstrap = staticmethod(bootstrap) # for testing get_config_loader = staticmethod(get_config_loader) # for testing pkg_resources = pkg_resources # for testing @@ -130,6 +131,7 @@ class PShellCommand: config_uri = self.args.config_uri config_vars = parse_vars(self.args.config_vars) + config_vars.setdefault('__script__', self.script_name) loader = self.get_config_loader(config_uri) loader.setup_logging(config_vars) self.pshell_file_config(loader, config_vars) diff --git a/src/pyramid/scripts/ptweens.py b/src/pyramid/scripts/ptweens.py index 494575ff7..cb19eec12 100644 --- a/src/pyramid/scripts/ptweens.py +++ b/src/pyramid/scripts/ptweens.py @@ -27,6 +27,7 @@ class PTweensCommand: will be assumed. Example: "ptweens myapp.ini#main". """ + script_name = 'ptweens' parser = argparse.ArgumentParser( description=textwrap.dedent(description), formatter_class=argparse.RawDescriptionHelpFormatter, @@ -81,6 +82,7 @@ class PTweensCommand: return 2 config_uri = self.args.config_uri config_vars = parse_vars(self.args.config_vars) + config_vars.setdefault('__script__', self.script_name) self.setup_logging(config_uri, global_conf=config_vars) env = self.bootstrap(config_uri, options=config_vars) registry = env['registry'] diff --git a/src/pyramid/scripts/pviews.py b/src/pyramid/scripts/pviews.py index f35daad45..be19e48bc 100644 --- a/src/pyramid/scripts/pviews.py +++ b/src/pyramid/scripts/pviews.py @@ -27,6 +27,7 @@ class PViewsCommand: specifies the path info portion of a URL that will be used to find matching views. Example: 'proutes myapp.ini#main /url' """ + script_name = 'pviews' stdout = sys.stdout parser = argparse.ArgumentParser( @@ -248,6 +249,7 @@ class PViewsCommand: return 2 config_uri = self.args.config_uri config_vars = parse_vars(self.args.config_vars) + config_vars.setdefault('__script__', self.script_name) url = self.args.url self.setup_logging(config_uri, global_conf=config_vars) |
