Guest User

Untitled

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