|
@@ -17,7 +17,7 @@ def typed_value(key, d):
|
|
|
except (TypeError, ValueError) as exc:
|
|
|
bb.msg.fatal("Data", "%s: %s" % (key, str(exc)))
|
|
|
|
|
|
-def export2json(d, json_file, expand=True):
|
|
|
+def export2json(d, json_file, expand=True, searchString="",replaceString=""):
|
|
|
data2export = {}
|
|
|
keys2export = []
|
|
|
|
|
@@ -37,9 +37,11 @@ def export2json(d, json_file, expand=True):
|
|
|
|
|
|
for key in keys2export:
|
|
|
try:
|
|
|
- data2export[key] = d.getVar(key, expand)
|
|
|
+ data2export[key] = d.getVar(key, expand).replace(searchString,replaceString)
|
|
|
except bb.data_smart.ExpansionError:
|
|
|
data2export[key] = ''
|
|
|
+ except AttributeError:
|
|
|
+ pass
|
|
|
|
|
|
with open(json_file, "w") as f:
|
|
|
json.dump(data2export, f, skipkeys=True, indent=4, sort_keys=True)
|