Please review this at http://codereview.appspot.com/186239/show
Affected files:
M setup.py
M trytond/protocols/jsonrpc.py
M trytond/pyson.py
Index: setup.py
===================================================================
--- a/setup.py
+++ b/setup.py
@@ -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 @@
'relatorio >= 0.2.0',
'Genshi',
'python-dateutil',
- 'simplejson',
- ],
+ ] + SIMPLEJSON,
extras_require={
'PostgreSQL': ['psycopg2 >= 2.0'],
'WebDAV': ['PyWebDAV >= 0.9.3'],
Index: trytond/protocols/jsonrpc.py
===================================================================
--- a/trytond/protocols/jsonrpc.py
+++ b/trytond/protocols/jsonrpc.py
@@ -6,10 +6,6 @@
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 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:
Index: trytond/pyson.py
===================================================================
--- a/trytond/pyson.py
+++ b/trytond/pyson.py
@@ -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 sys
+if sys.version_info < (2, 6):
+ import simplejson as json
+else:
import json
-except ImportError:
- import simplejson as json
import datetime
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier
pgpbHE9pKnMWk.pgp
Description: PGP signature
