From ea2ef9876d62a7876f1f6b7c7d583c79258ead0f Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 10 Jul 2015 00:41:44 -0700 Subject: [PATCH] Some Unicode fixes for Python 3 --- rophako/jsondb.py | 2 +- rophako/model/blog.py | 5 +++++ rophako/modules/blog/__init__.py | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rophako/jsondb.py b/rophako/jsondb.py index cdfe16d..a48f08d 100644 --- a/rophako/jsondb.py +++ b/rophako/jsondb.py @@ -188,7 +188,7 @@ def write_json(path, data): flock(fh, LOCK_EX) # Write it. - fh.write(json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))) + fh.write(json.dumps(data, indent=4, separators=(',', ': '))) # Unlock and close. flock(fh, LOCK_UN) diff --git a/rophako/model/blog.py b/rophako/model/blog.py index a9f9255..b1c3cbd 100644 --- a/rophako/model/blog.py +++ b/rophako/model/blog.py @@ -8,6 +8,11 @@ import time import re import glob import os +import sys + +if sys.version_info[0] > 2: + def unicode(s): + return s from rophako.settings import Config import rophako.jsondb as JsonDB diff --git a/rophako/modules/blog/__init__.py b/rophako/modules/blog/__init__.py index 69401a6..d314075 100644 --- a/rophako/modules/blog/__init__.py +++ b/rophako/modules/blog/__init__.py @@ -19,6 +19,11 @@ from rophako.plugin import load_plugin from rophako.settings import Config from rophako.log import logger +import sys +if sys.version_info[0] > 2: + def unicode(s): + return str(s) + mod = Blueprint("blog", __name__, url_prefix="/blog") load_plugin("rophako.modules.comment")