From f27314027e1d88c23c49d9eede1e7604f8f0b96f Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 5 Feb 2024 16:20:43 +0100 Subject: [PATCH] fix deefuzzer path, fix yaml unicode (py2) --- telecaster/models.py | 2 +- telecaster/tools/tools.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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 -- 2.39.5