Commit 33b34339 authored by Julien Muchembled's avatar Julien Muchembled

fixup! Add support for a few built-in python object types as values

Another follow-up to fix MissingOption when the serialised value is None.
parent 7a5dd160
...@@ -66,6 +66,8 @@ def print_(*args, **kw): ...@@ -66,6 +66,8 @@ def print_(*args, **kw):
file = sys.stdout file = sys.stdout
file.write(sep.join(map(str, args))+end) file.write(sep.join(map(str, args))+end)
_MARKER = []
class BuildoutSerialiser(object): class BuildoutSerialiser(object):
# XXX: I would like to access pprint._safe_repr, but it's not # XXX: I would like to access pprint._safe_repr, but it's not
# officially available. PrettyPrinter class has a functionally-speaking # officially available. PrettyPrinter class has a functionally-speaking
...@@ -1536,8 +1538,8 @@ class Options(DictMixin): ...@@ -1536,8 +1538,8 @@ class Options(DictMixin):
return ''.join([''.join(v) for v in zip(value[::2], subs)]) return ''.join([''.join(v) for v in zip(value[::2], subs)])
def __getitem__(self, key): def __getitem__(self, key):
v = self.get(key) v = self.get(key, _MARKER)
if v is None: if v is _MARKER:
raise MissingOption("Missing option: %s:%s" % (self.name, key)) raise MissingOption("Missing option: %s:%s" % (self.name, key))
return v return v
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment