diff --git a/src/memory/memory.py b/src/memory/memory.py index 47af0682..66363e0d 100644 --- a/src/memory/memory.py +++ b/src/memory/memory.py @@ -20,6 +20,7 @@ from __future__ import with_statement import os.path +import csv from ConfigParser import SafeConfigParser, NoOptionError, NoSectionError from xml.dom import minidom from logging import debug, info, warning, error @@ -651,11 +652,19 @@ class Memory(object): if not section: section = 'DEFAULT' try: - _value = self.config.get(section, name) + value = self.config.get(section, name) except (NoOptionError, NoSectionError): - _value = '' + value = '' - return os.path.expanduser(_value) if name.endswith('_path') or name.endswith('_dir') else _value + if name.endswith('_path') or name.endswith('_dir'): + value = os.path.expanduser(value) + # thx to Brian (http://stackoverflow.com/questions/186857/splitting-a-semicolon-separated-string-to-a-dictionary-in-python/186873#186873) + elif name.endswith('_list'): + value = csv.reader([value], delimiter=',', quotechar='"').next() + elif name.endswith('_dict'): + value = dict(csv.reader([item], delimiter=':', quotechar='"').next() + for item in csv.reader([value], delimiter=',', quotechar='"').next()) + return value def load_xml(self, filename): """Load parameters template from xml file"""