diff options
author | fuzzyman <devnull@localhost> | 2009-11-21 16:23:56 +0000 |
---|---|---|
committer | fuzzyman <devnull@localhost> | 2009-11-21 16:23:56 +0000 |
commit | c6a90736335e2dae94cf7b52cbbfcd2c31165097 (patch) | |
tree | 677841226f911c9da53d5c30eb5bec00472f784d | |
parent | c58901ce622a846bee6df45f2225e2e2c2a6e15c (diff) | |
download | configobj-c6a90736335e2dae94cf7b52cbbfcd2c31165097.tar.gz |
Test for validate with preserve_errors
-rw-r--r-- | configobj.py | 6 | ||||
-rw-r--r-- | docs/configobj.txt | 11 | ||||
-rw-r--r-- | test_configobj.py | 3 |
3 files changed, 14 insertions, 6 deletions
diff --git a/configobj.py b/configobj.py index 762f4a7..6bcde33 100644 --- a/configobj.py +++ b/configobj.py @@ -527,6 +527,7 @@ class Section(dict): self.defaults = [] self.default_values = {} self.extra_values = [] + self._created = False def _interpolate(self, key, value): @@ -1905,6 +1906,7 @@ class ConfigObj(Section): continue if entry not in section: section[entry] = {} + section[entry]._created = True if copy: # copy comments section.comments[entry] = configspec.comments.get(entry, []) @@ -2243,10 +2245,12 @@ class ConfigObj(Section): ret_true = False section.extra_values = unvalidated + if preserve_errors and section._created: + ret_false = False # if ret_true: return True - elif ret_false and not preserve_errors: + elif ret_false: return False return out diff --git a/docs/configobj.txt b/docs/configobj.txt index 75a7b5c..86bb889 100644 --- a/docs/configobj.txt +++ b/docs/configobj.txt @@ -2284,23 +2284,24 @@ This is an abbreviated changelog showing the major releases up to version 4. From version 4 it lists all releases and changes. -2009/09/XX - Version 4.7.0 +2009/10/XX - Version 4.7.0 -------------------------- * Minimum supported version of Python is now 2.3 * ~25% performance improvement thanks to Christian Heimes -* Removed __revision__ and __docformat__ -* BUGFIX: Checks that failed validation would not populate 'default_values' and - 'restore_default_value' wouldn't work * String interpolation now works in list values * After validation any additional entries not in the configspec are listed in the 'extra_values' section member +* BUGFIX: Checks that failed validation would not populate 'default_values' and + 'restore_default_value' wouldn't work for those entries * BUGFIX: clear() clears 'defaults' * BUGFIX: empty values in list values were accidentally valid syntax. They now raise a ParseError. e.g. "value = 1, , 2" * If a section specified in a configspec is missing, or all the values in a section are missing, will have False for all the values in the result - returned by by ``ConfigObj.validate``. + returned by by ``ConfigObj.validate`` +* Distribution includes version 1.0.1 of validate.py +* Removed __revision__ and __docformat__ 2009/04/13 - Version 4.6.0 diff --git a/test_configobj.py b/test_configobj.py index 940692d..dbdc712 100644 --- a/test_configobj.py +++ b/test_configobj.py @@ -2118,6 +2118,9 @@ def _test_validation_with_preserve_errors(): {'section': {'foo': False}} """ + +# test _created on Section + # TODO: Test BOM handling # TODO: Test error code for badly built multiline values # TODO: Test handling of StringIO |