Better test to import json

There is an other json module for python < 2.6
This commit is contained in:
Cédric Krier committed 2010-01-20 15:22:33 +01:00
1 parent 5f7a1084c9
commit 5819e2cbe9
3 files changed
+14 -9

No files matched your search

+6 -2
View File
@@ -4,9 +4,14 @@
from setuptools import setup, find_packages
import os
import sys
execfile(os.path.join('trytond', 'version.py'))
SIMPLEJSON = []
if sys.version_info < (2, 6):
SIMPLEJSON = ['simplejson']
setup(name=PACKAGE,
version=VERSION,
description='Tryton server',
@@ -46,8 +51,7 @@ setup(name=PACKAGE,
'relatorio >= 0.2.0',
'Genshi',
'python-dateutil',
'simplejson',
],
] + SIMPLEJSON,
extras_require={
'PostgreSQL': ['psycopg2 >= 2.0'],
'WebDAV': ['PyWebDAV >= 0.9.3'],
+4 -4
View File
@@ -6,10 +6,6 @@ from trytond.config import CONFIG
import SimpleXMLRPCServer
import SimpleHTTPServer
import SocketServer
try:
import json
except ImportError:
import simplejson as json
from xmlrpclib import Fault
import threading
import traceback
@@ -26,6 +22,10 @@ import posixpath
import urllib
import datetime
from decimal import Decimal
if sys.version_info < (2, 6):
import simplejson as json
else:
import json
def object_hook(dct):
if '__class__' in dct:
+4 -3
View File
@@ -1,9 +1,10 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
try:
import json
except ImportError:
import sys
if sys.version_info < (2, 6):
import simplejson as json
else:
import json
import datetime