]> git.parisson.com Git - telecaster-client.git/commitdiff
fix deefuzzer path, fix yaml unicode (py2)
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 5 Feb 2024 15:20:43 +0000 (16:20 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 5 Feb 2024 15:20:43 +0000 (16:20 +0100)
telecaster/models.py
telecaster/tools/tools.py

index a33e5dd5cae264cfe24db4bd6cf690c7fb6a1f4b..4802dc151eef12a97a56b2dafd88dc98b95b38d6 100644 (file)
@@ -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 + ' &'
index f4a1ed9a9a8518dae4790b2e39aa0ea86d4f6784..e0d09fcb5eab8ddcdae79e682b76ba04d9347f25 100644 (file)
@@ -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