Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From ffb45b4a23d07984eb89977e2a0de51d4cd50b0a Mon Sep 17 00:00:00 2001
- From: Richard Maw <[email protected]>
- Date: Wed, 24 Sep 2014 10:15:51 +0000
- Subject: [PATCH] Safely interpolate in environment variable reporting
- The msg parameter to status is a format string. If we pass a string
- directly to it, then we have to be careful to escape any formatting
- characters.
- However, we can just do the interpolation directly in the status call
- instead, which is less code.
- ---
- morphlib/util.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- diff --git a/morphlib/util.py b/morphlib/util.py
- index ae1df56..dc3dd47 100644
- --- a/morphlib/util.py
- +++ b/morphlib/util.py
- @@ -228,8 +228,8 @@ def log_environment_changes(app, current_env, previous_env): # pragma: no cover
- value_msg = '(value hidden)'
- else:
- value_msg = '= "%s"' % value
- - msg = '%s environment variable %s %s' % (event, key, value_msg)
- - app.status(msg=msg, chatty=True)
- + app.status(msg='%(event)s environment variable %(key)s %(value)s',
- + event=event, key=key, value=value_msg, chatty=True)
- for key in current_env.keys():
- if key not in previous_env:
- --
- 1.8.4
Advertisement
Add Comment
Please, Sign In to add comment