From 70d093b19351c7244b3fbb02ef39573923ed5d1a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Oct 2017 17:14:20 +0200 Subject: [PATCH] unicode gave an NameError with python3 --- cps/ub.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cps/ub.py b/cps/ub.py index a559db43..3d589c64 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -6,6 +6,7 @@ from sqlalchemy import exc from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import * from flask_login import AnonymousUserMixin +import sys import os import logging from werkzeug.security import generate_password_hash @@ -387,7 +388,11 @@ class Config: (self.config_default_role & ROLE_DELETE_BOOKS == ROLE_DELETE_BOOKS)) def mature_content_tags(self): - return list(map(unicode.lstrip, self.config_mature_content_tags.split(","))) + if (sys.version_info > (3, 0)): #Python3 str, Python2 unicode + lstrip = str.lstrip + else: + lstrip = unicode.lstrip + return list(map(lstrip, self.config_mature_content_tags.split(","))) def get_Log_Level(self): ret_value=""