From c96b2a3f4c561bb750c3c768463564a607a1783d Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Thu, 19 Oct 2017 15:34:02 -0400 Subject: [PATCH] Fix for https://github.com/Phyks/Flatisfy/issues/8 --- flatisfy/config.py | 2 +- flatisfy/email.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/flatisfy/config.py b/flatisfy/config.py index d879630..7f4bc28 100644 --- a/flatisfy/config.py +++ b/flatisfy/config.py @@ -126,7 +126,7 @@ def validate_config(config, check_with_data): assert config["backends"] is None or isinstance(config["backends"], list) # noqa: E501 assert isinstance(config["send_email"], bool) - assert config["smtp_server"] is None or isinstance(config["smtp_server"], (str, unicode)) # noqa: E501 + assert config["smtp_server"] is None or isinstance(config["smtp_server"], str) # noqa: E501 assert config["smtp_port"] is None or isinstance(config["smtp_port"], int) # noqa: E501 assert config["smtp_to"] is None or isinstance(config["smtp_to"], list) diff --git a/flatisfy/email.py b/flatisfy/email.py index f33d79e..d35526e 100644 --- a/flatisfy/email.py +++ b/flatisfy/email.py @@ -4,6 +4,7 @@ Email notifications. """ from __future__ import absolute_import, print_function, unicode_literals +from builtins import str import logging import smtplib @@ -72,11 +73,11 @@ def send_notification(config, flats): website_url = config["website_url"] for flat in flats: - title = unicode(flat.title) - flat_id = unicode(flat.id) - area = unicode(flat.area) - cost = unicode(flat.cost) - currency = unicode(flat.currency) + title = str(flat.title) + flat_id = str(flat.id) + area = str(flat.area) + cost = str(flat.cost) + currency = str(flat.currency) txt += ( '- {}: {}#/flat/{} (area: {}, cost: {} {})\n'.format(