From 896e0ab322d0b544ab21fb77b3339878b63320f3 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 13 Jun 2012 16:24:00 +0200 Subject: [PATCH] Unicode fix for logging.partial. fix #366 --- couchpotato/core/plugins/log/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/log/main.py b/couchpotato/core/plugins/log/main.py index 55b2cdbd..83e190ab 100644 --- a/couchpotato/core/plugins/log/main.py +++ b/couchpotato/core/plugins/log/main.py @@ -1,5 +1,7 @@ from couchpotato.api import addApiView +from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.request import jsonified, getParam, getParams +from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.environment import Env @@ -78,7 +80,7 @@ class Logging(Plugin): def partial(self): log_type = getParam('type', 'all') - total_lines = getParam('lines', 30) + total_lines = tryInt(getParam('lines', 30)) log_lines = [] @@ -92,7 +94,7 @@ class Logging(Plugin): reversed_lines = [] f = open(path, 'r') - reversed_lines = f.read().split('[0m\n') + reversed_lines = toUnicode(f.read()).split('[0m\n') reversed_lines.reverse() brk = False