support for werkzeug 0.8 (Python2-only)

This commit is contained in:
Martin Zimmermann 2013-11-04 00:54:28 +01:00
parent 312578457b
commit e14a04ab6c
2 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,9 @@
from __future__ import division
import pkg_resources
werkzeug = pkg_resources.get_distribution("werkzeug")
import json
import random
import hashlib
@ -91,6 +94,10 @@ class Bloomfilter:
class JSONRequest(Request):
if werkzeug.version.startswith("0.8"):
def get_data(self):
return self.data.decode('utf-8')
def get_json(self):
try:
return json.loads(self.get_data().decode('utf-8'))

View File

@ -5,13 +5,15 @@ import sys
from setuptools import setup, find_packages
requires = ['werkzeug>=0.9', 'itsdangerous', 'misaka', 'html5lib']
requires = ['itsdangerous', 'misaka', 'html5lib']
if (3, 0) <= sys.version_info < (3, 3):
raise SystemExit("Python 3.0, 3.1 and 3.2 are not supported")
if sys.version_info < (3, 0):
requires += ['ipaddress', 'configparser']
requires += ['ipaddress', 'configparser', 'werkzeug>=0.8']
else:
requires += ['werkzeug>=0.9']
setup(
name='isso',