mirror of https://github.com/docker/compose.git
Support non-alphanumeric default values.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
8f636d8279
commit
2bce81508e
|
@ -72,7 +72,7 @@ def recursive_interpolate(obj, interpolator):
|
|||
|
||||
|
||||
class TemplateWithDefaults(Template):
|
||||
idpattern = r'[_a-z][_a-z0-9]*(?::?-[_a-z0-9]+)?'
|
||||
idpattern = r'[_a-z][_a-z0-9]*(?::?-[^}]+)?'
|
||||
|
||||
# Modified from python2.7/string.py
|
||||
def substitute(self, mapping):
|
||||
|
|
|
@ -113,6 +113,7 @@ def test_interpolate_with_value(defaults_interpolator):
|
|||
def test_interpolate_missing_with_default(defaults_interpolator):
|
||||
assert defaults_interpolator("ok ${missing:-def}") == "ok def"
|
||||
assert defaults_interpolator("ok ${missing-def}") == "ok def"
|
||||
assert defaults_interpolator("ok ${BAR:-/non:-alphanumeric}") == "ok /non:-alphanumeric"
|
||||
|
||||
|
||||
def test_interpolate_with_empty_and_default_value(defaults_interpolator):
|
||||
|
|
Loading…
Reference in New Issue