aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2013-07-24 19:40:10 +0200
committerAndré Erdmann <dywi@mailerd.de>2013-07-24 19:43:54 +0200
commit1dafffc5c417cba0ba4eafc1d5830ba63be149f1 (patch)
tree3d00cc538e765275e1e4ca65d6adce7dbb2d5312 /roverlay/config
parentstats collection: repolist, distmap (diff)
downloadR_overlay-1dafffc5c417cba0ba4eafc1d5830ba63be149f1.tar.gz
R_overlay-1dafffc5c417cba0ba4eafc1d5830ba63be149f1.tar.bz2
R_overlay-1dafffc5c417cba0ba4eafc1d5830ba63be149f1.zip
roverlay/config: set value_type to str if unset
This removes (unwanted) quote chars in config values. Config options that want to keep the old behavior can do so by setting value_type=False.
Diffstat (limited to 'roverlay/config')
-rw-r--r--roverlay/config/loader.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index 8bb3826..8c6a630 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -99,10 +99,9 @@ class ConfigLoader ( object ):
if path:
# verify and convert value if value_type is set
- if cref.get ( "value_type", None ):
- value = self._make_and_verify_value (
- cref ['value_type'], value
- )
+ value = self._make_and_verify_value (
+ cref.get ( 'value_type', str ), value
+ )
# --- end prepare value;
value_choices = cref.get ( "choices", None )
@@ -443,7 +442,10 @@ class ConfigLoader ( object ):
# --- end of _regex (...) ---
# replace whitespace with a single ' '
- value = unquote ( ConfigLoader.WHITESPACE.sub ( ' ', value ) )
+ if value_type is False:
+ return ConfigLoader.WHITESPACE.sub ( ' ', value )
+ else:
+ value = unquote ( ConfigLoader.WHITESPACE.sub ( ' ', value ) )
# convert value_type into a list of value types
if not value_type: