avocado.settings: Do a better job returning list values

Use python's ast module to safely evaluate the list values.
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 813f3b24
......@@ -15,6 +15,7 @@
"""
Reads the avocado settings from a .ini file (from python ConfigParser).
"""
import ast
import ConfigParser
import os
import sys
......@@ -129,8 +130,7 @@ def convert_value_type(value, value_type):
return True
if value_type == list:
# Split the string using ',' and return a list
return [val.strip() for val in sval.split(',')]
return ast.literal_eval(sval)
conv_val = value_type(sval)
return conv_val
......
......@@ -20,7 +20,7 @@ str_key = frobnicate
int_key = 1
float_key = 1.25
bool_key = True
list_key = I, love, settings
list_key = ['I', 'love', 'settings']
empty_key =
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册