From a69f0cb7234329e36386954b86d9c8b0cc60135a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20K=C3=A1cha?= <ph@cesnet.cz>
Date: Mon, 5 Oct 2015 16:31:17 +0200
Subject: [PATCH] Logging module in Python 2.6 does not accept unicode socket
 path - but strings from JSON configuration are always unicode. Applied
 workaround, now on 2.6 Client accepts at least ASCII filenames for syslog
 socket.

---
 warden3/warden_client/warden_client.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/warden3/warden_client/warden_client.py b/warden3/warden_client/warden_client.py
index a2252d5..431ad88 100644
--- a/warden3/warden_client/warden_client.py
+++ b/warden3/warden_client/warden_client.py
@@ -11,6 +11,9 @@ from sys import stderr, exc_info
 from traceback import format_tb
 from os import path
 from operator import itemgetter
+from sys import version_info
+
+fix_logging_filename = str if version_info<(2.7) else lambda(x): x
 
 
 VERSION = "3.0-beta2"
@@ -292,7 +295,7 @@ class Client(object):
         if syslog is not None:
             try:
                 sl = logging.handlers.SysLogHandler(
-                    address=syslog.get("socket", "/dev/log"),
+                    address=fix_logging_filename(syslog.get("socket", "/dev/log")),
                     facility=facility(syslog.get("facility", "local7")))
                 sl.setLevel(loglevel(syslog.get("level", "debug")))
                 sl.setFormatter(format_notime)
-- 
GitLab