diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-02-01 22:51:08 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-02-01 22:53:18 +0100 |
| commit | 04141c525d2b5021b8e9d2452582181097a0850d (patch) | |
| tree | d5c7e06717e60c0678f8de8d3daea292778b5fd3 /django/utils/termcolors.py | |
| parent | 0412b7d28072ddef7dc1d0b363b6c6c88a439be8 (diff) | |
Fixed #19663 -- Allowed None in colorize() text parameter
Thanks Jonathan Liuti for the report and the initial patch, and
Simon Charette for the review.
Diffstat (limited to 'django/utils/termcolors.py')
| -rw-r--r-- | django/utils/termcolors.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/termcolors.py b/django/utils/termcolors.py index 4f74b564a5..bb14837716 100644 --- a/django/utils/termcolors.py +++ b/django/utils/termcolors.py @@ -52,8 +52,8 @@ def colorize(text='', opts=(), **kwargs): if o in opt_dict: code_list.append(opt_dict[o]) if 'noreset' not in opts: - text = text + '\x1b[%sm' % RESET - return ('\x1b[%sm' % ';'.join(code_list)) + text + text = '%s\x1b[%sm' % (text or '', RESET) + return '%s%s' % (('\x1b[%sm' % ';'.join(code_list)), text or '') def make_style(opts=(), **kwargs): """ |
