From 920b0b012007d2f6c17fe91b52cc9244478f48b7 Mon Sep 17 00:00:00 2001 From: Nick Stenning Date: Tue, 10 Mar 2015 13:44:18 +0100 Subject: [PATCH] Add support for multiline strings in .env We previously supported this but regressed support in 08063ea. Fixes #128. Closes #129. --- honcho/environ.py | 2 ++ honcho/test/unit/test_environ.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/honcho/environ.py b/honcho/environ.py index 593926f..6f2862e 100644 --- a/honcho/environ.py +++ b/honcho/environ.py @@ -91,6 +91,8 @@ def parse(content): continue if not re.match(r'[A-Za-z_][A-Za-z_0-9]*', name): continue + + value = value.decode('string_escape') values[name] = value return values diff --git a/honcho/test/unit/test_environ.py b/honcho/test/unit/test_environ.py index e727d06..2558a49 100644 --- a/honcho/test/unit/test_environ.py +++ b/honcho/test/unit/test_environ.py @@ -102,7 +102,20 @@ MYVAR='sp ace' """, {'MYVAR': 'sp ace'} - ] + ], + [ + # Escaped characters in value + r""" + TABS='foo\tbar' + NEWLINES='foo\nbar' + VTAB='foo\vbar' + DOLLAR='foo\$bar' + """, + {'TABS': 'foo\tbar', + 'NEWLINES': 'foo\nbar', + 'VTAB': 'foo\vbar', + 'DOLLAR': 'foo\\$bar'} + ], ] PROCFILE_FIXTURES = [