From 7818207908e3753a6ee6ea55417b484677391ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sat, 14 May 2016 20:47:10 -0500 Subject: [PATCH] Posts from twitter are displayed properly --- src/logger.py | 2 +- src/utils.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/logger.py b/src/logger.py index 135f144..b37a01b 100644 --- a/src/logger.py +++ b/src/logger.py @@ -6,7 +6,7 @@ import sys APP_LOG_FILE = 'debug.log' ERROR_LOG_FILE = "error.log" -MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s" +MESSAGE_FORMAT = u"%(asctime)s %(name)s %(levelname)s: %(message)s" DATE_FORMAT = u"%d/%m/%Y %H:%M:%S" formatter = logging.Formatter(MESSAGE_FORMAT.decode("utf-8"), datefmt=DATE_FORMAT) diff --git a/src/utils.py b/src/utils.py index 6c27848..974e40d 100644 --- a/src/utils.py +++ b/src/utils.py @@ -3,7 +3,8 @@ import os import requests import re - +import logging +log = logging.getLogger("utils") url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*") bad_chars = '\'\\.,[](){}:;"' @@ -56,4 +57,5 @@ def download_file(url, local_filename, window): def clean_text(text): """ Replaces all HTML entities and put the plain text equivalent if it's possible.""" text = text.replace("
", "\n") + text = text.replace("\\n", "\n") return text \ No newline at end of file