make it actually work, lol

This commit is contained in:
AJ ONeal 2015-12-19 19:08:26 -08:00
parent 5834541c02
commit 594d97e5c4
1 changed files with 7 additions and 9 deletions

View File

@ -98,11 +98,7 @@ function toPyVal(val) {
return val; return val;
} }
else if (Array.isArray(val)) { else if (Array.isArray(val)) {
val = val.join(','); return val.join(',');
if (-1 === val.indexOf(',')) {
val += ','; // disambguates value from array with one element
}
return val;
} }
return val && JSON.stringify(val); return val && JSON.stringify(val);
@ -132,17 +128,19 @@ function stringifyPythonConf(obj, cb) {
return; return;
} }
if ('[' === pykey[0]) {
return;
}
// restore comments // restore comments
if (-1 !== obj.__lines[num].indexOf('#')) { if (-1 !== obj.__lines[num].indexOf('#')) {
comment = obj.__lines[num].replace(/.*?(\s*#.*)/, '$1'); comment = obj.__lines[num].replace(/.*?(\s*#.*)/, '$1');
} }
if ('[' === pykey[0]) {
return;
}
if ('undefined' === typeof pyval) { if ('undefined' === typeof pyval) {
obj.__lines[num] = "___DELETE_ME___"; obj.__lines[num] = "___DELETE_ME___";
} else {
obj.__lines[num] = pykey + ' = ' + pyval + comment;
} }
}); });