From: Guillaume Pellerin Date: Mon, 5 Feb 2024 15:20:43 +0000 (+0100) Subject: fix deefuzzer path, fix yaml unicode (py2) X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f27314027e1d88c23c49d9eede1e7604f8f0b96f;p=telecaster-client.git fix deefuzzer path, fix yaml unicode (py2) --- diff --git a/telecaster/models.py b/telecaster/models.py index a33e5dd..4802dc1 100644 --- a/telecaster/models.py +++ b/telecaster/models.py @@ -189,7 +189,7 @@ class Station(Model): self.save() def deefuzzer_write_conf(self): - write_conf(self.conf, self.deefuzzer_file) + write_conf(self.conf, self.deefuzzer_file.path) def deefuzzer_start(self): command = '/usr/local/bin/deefuzzer ' + self.deefuzzer_file.path + ' &' diff --git a/telecaster/tools/tools.py b/telecaster/tools/tools.py index f4a1ed9..e0d09fc 100644 --- a/telecaster/tools/tools.py +++ b/telecaster/tools/tools.py @@ -204,7 +204,14 @@ def write_conf(conf_dict, path): elif 'yaml' in ext or 'yml' in ext: import yaml - yaml.dump(conf_dict, f) + def represent_unicode(dumper, data): + return dumper.represent_scalar(u'tag:yaml.org,2002:str', data) + yaml.add_representer(unicode, represent_unicode) + yaml.dump(conf_dict, f, encoding='utf-8', + allow_unicode=True, + default_flow_style=False, + explicit_start=True + ) elif 'json' in ext: import json