Parsing JSON config files did not transform linkRoute, autoLink and address. Fixed this
@@ -44,6 +44,15 @@ class Config(object):
else:
self.entities = []
+ @staticmethod
+ def transform_sections(sections):
+ for s in sections:
+ s[0] = camelcase(s[0])
+ s[1] = dict((camelcase(k), v) for k, v in s[1].iteritems())
+ if s[0] == "address": s[0] = "router.config.address"
+ if s[0] == "linkRoute": s[0] = "router.config.linkRoute"
+ if s[0] == "autoLink": s[0] = "router.config.autoLink"
+
@staticmethod
def _parse(lines):
"""Parse config file format into a section list"""
@@ -64,12 +73,7 @@ class Config(object):
js_text = re.sub(spare_comma, r'\1', js_text)
# Convert dictionary keys to camelCase
sections = json.loads(js_text)
- for s in sections:
- s[0] = camelcase(s[0])
- s[1] = dict((camelcase(k), v) for k, v in s[1].iteritems())
- if s[0] == "address": s[0] = "router.config.address"
- if s[0] == "linkRoute": s[0] = "router.config.linkRoute"
- if s[0] == "autoLink": s[0] = "router.config.autoLink"
+ Config.transform_sections(sections)
return sections
@staticmethod
@@ -81,6 +85,7 @@ class Config(object):
return line
js_text = "%s"%("\n".join([sub(l) for l in lines]))
sections = json.loads(js_text)
+ Config.transform_sections(sections)
return sections
def get_config_types(self):
