summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/PyFile.py4
-rw-r--r--module/plugins/Base.py13
2 files changed, 16 insertions, 1 deletions
diff --git a/module/PyFile.py b/module/PyFile.py
index d70f852d1..4f8b95124 100644
--- a/module/PyFile.py
+++ b/module/PyFile.py
@@ -100,6 +100,10 @@ class PyFile(object):
return self._name
def setName(self, name):
+ """ Only set unicode or utf8 strings as name """
+ if type(name) == str:
+ name = name.decode("utf8")
+
self._name = name
name = property(getName, setName)
diff --git a/module/plugins/Base.py b/module/plugins/Base.py
index 48a3707b1..34074095e 100644
--- a/module/plugins/Base.py
+++ b/module/plugins/Base.py
@@ -18,6 +18,7 @@
"""
import sys
+from module.utils import decode
from module.utils.fs import exists, makedirs, join
# TODO
@@ -101,7 +102,17 @@ class Base(object):
else:
sep = " | "
- getattr(self.log, level)("%s: %s" % (self.__name__, sep.join([a if isinstance(a, basestring) else str(a) for a in args])))
+
+ strings = []
+ for obj in args:
+ if type(obj) == unicode:
+ strings.append(obj)
+ elif type(obj) == str:
+ strings.append(decode(obj))
+ else:
+ strings.append(str(obj))
+
+ getattr(self.log, level)("%s: %s" % (self.__name__, sep.join(strings)))
def setConfig(self, option, value):
""" Set config value for current plugin