Skip to content

Commit

Permalink
set script name via dict.setdefault()
Browse files Browse the repository at this point in the history
  • Loading branch information
adroullier committed Oct 30, 2023
1 parent caa7126 commit 93140ef
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 18 deletions.
4 changes: 1 addition & 3 deletions src/pyramid/scripts/prequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ def run(self):
return 2
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
config_vars.setdefault('__script__', self.script_name)
path = self.args.path_info

loader = self._get_config_loader(config_uri)
Expand Down
4 changes: 1 addition & 3 deletions src/pyramid/scripts/proutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ def run(self, quiet=False):

config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
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)
Expand Down
4 changes: 1 addition & 3 deletions src/pyramid/scripts/pserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ def run(self): # pragma: no cover
return 2
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
config_vars.setdefault('__script__', self.script_name)
app_spec = self.args.config_uri
app_name = self.args.app_name

Expand Down
4 changes: 1 addition & 3 deletions src/pyramid/scripts/pshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ def run(self, shell=None):

config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
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)
Expand Down
4 changes: 1 addition & 3 deletions src/pyramid/scripts/ptweens.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def run(self):
return 2
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
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']
Expand Down
4 changes: 1 addition & 3 deletions src/pyramid/scripts/pviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ def run(self):
return 2
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
config_vars.setdefault('__script__', self.script_name)
url = self.args.url

self.setup_logging(config_uri, global_conf=config_vars)
Expand Down

0 comments on commit 93140ef

Please sign in to comment.