Commit 102a250e authored by Vincent Pelletier's avatar Vincent Pelletier

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

Make Options.copy return de-serialised values.
Make _save_option accept non-string values.
parent afaee7d6
1.6.0-dev-SlapOS-008
--------------------
- Fix assigning non-string values to section keys:
Make Options.copy return de-serialised values.
Make _save_option accept non-string values.
1.6.0-dev-SlapOS-007 1.6.0-dev-SlapOS-007
-------------------- --------------------
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
############################################################################## ##############################################################################
name = "zc.buildout" name = "zc.buildout"
version = "1.6.0-dev-SlapOS-007" version = "1.6.0-dev-SlapOS-008"
import os import os
from setuptools import setup from setuptools import setup
......
...@@ -1545,6 +1545,9 @@ class Options(UserDict.DictMixin): ...@@ -1545,6 +1545,9 @@ class Options(UserDict.DictMixin):
def copy(self): def copy(self):
result = self._raw.copy() result = self._raw.copy()
for key, value in result.iteritems():
if value.startswith(SERIALISED_VALUE_MAGIC):
result[key] = loads(value)
result.update(self._cooked) result.update(self._cooked)
result.update(self._data) result.update(self._data)
return result return result
...@@ -1634,6 +1637,8 @@ def _quote_spacey_nl(match): ...@@ -1634,6 +1637,8 @@ def _quote_spacey_nl(match):
return result return result
def _save_option(option, value, f): def _save_option(option, value, f):
if not isinstance(value, str):
value = dumps(value)
value = _spacey_nl.sub(_quote_spacey_nl, value) value = _spacey_nl.sub(_quote_spacey_nl, value)
if value.startswith('\n\t'): if value.startswith('\n\t'):
value = '%(__buildout_space_n__)s' + value[2:] value = '%(__buildout_space_n__)s' + value[2:]
......
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