From f9133b984edd53790cf9c075225111c34874105e Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Wed, 9 Oct 2013 15:49:12 +0200 Subject: [PATCH] use configparser backport to support python2.6 again --- isso/core.py | 7 ++++--- isso/views/comment.py | 4 ++-- setup.py | 2 +- tox.ini | 5 +++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/isso/core.py b/isso/core.py index 2c102cf..364369e 100644 --- a/isso/core.py +++ b/isso/core.py @@ -5,6 +5,7 @@ from __future__ import print_function import io import os import time +import binascii import thread import threading @@ -15,7 +16,7 @@ import smtplib import httplib import urlparse -from ConfigParser import ConfigParser +from configparser import ConfigParser try: import uwsgi @@ -29,7 +30,7 @@ class Config: default = [ "[general]", - "dbpath = /tmp/isso.db", "secretkey = %r" % os.urandom(24), + "dbpath = /tmp/isso.db", "secretkey = %r" % binascii.b2a_hex(os.urandom(24)), "host = http://localhost:8080/", "passphrase = p@$$w0rd", "max-age = 900", "[server]", @@ -48,7 +49,7 @@ class Config: def load(cls, configfile): rv = ConfigParser(allow_no_value=True) - rv.readfp(io.StringIO(u'\n'.join(Config.default))) + rv.read_file(io.StringIO(u'\n'.join(Config.default))) if configfile: rv.read(configfile) diff --git a/isso/views/comment.py b/isso/views/comment.py index 384c911..46f2ea3 100644 --- a/isso/views/comment.py +++ b/isso/views/comment.py @@ -15,8 +15,8 @@ from werkzeug.exceptions import abort, BadRequest from isso import utils, notify, db from isso.crypto import pbkdf2 -FIELDS = {'id', 'parent', 'text', 'author', 'website', 'email', 'mode', 'created', - 'modified', 'likes', 'dislikes', 'hash'} +FIELDS = set(['id', 'parent', 'text', 'author', 'website', 'email', 'mode', + 'created', 'modified', 'likes', 'dislikes', 'hash']) class requires: diff --git a/setup.py b/setup.py index d821d80..c688990 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from setuptools import setup, find_packages requires = ['Jinja2>=2.7', 'werkzeug>=0.9', 'itsdangerous', 'misaka', 'html5lib'] if sys.version_info < (3, 0): - requires += ['ipaddress'] + requires += ['ipaddress', 'configparser'] setup( name='isso', diff --git a/tox.ini b/tox.ini index d9c27d1..47be448 100755 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,11 @@ indexserver = [testenv:py26] deps = argparse + configparser + {[testenv]deps} +[testenv:py27] +deps = + configparser {[testenv]deps} [testenv] deps =