From: Torsten Werner Date: Sun, 23 Jan 2011 20:53:13 +0000 (+0100) Subject: JSON: support python 2.5, too. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c76e10042115760eed33fce79a9917d006118bf;p=dak JSON: support python 2.5, too. The json module is available in version 2.6 but we have simplejson in 2.5. Signed-off-by: Torsten Werner --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 846addd7..13645394 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -38,7 +38,14 @@ import re import psycopg2 import traceback import commands -import json + +try: + # python >= 2.6 + import json +except: + # python <= 2.5 + import simplejson as json + from datetime import datetime, timedelta from errno import ENOENT from tempfile import mkstemp, mkdtemp diff --git a/tests/dbtest_ormobject.py b/tests/dbtest_ormobject.py index a5b77553..d1c72de4 100755 --- a/tests/dbtest_ormobject.py +++ b/tests/dbtest_ormobject.py @@ -4,7 +4,13 @@ from db_test import DBDakTestCase from daklib.dbconn import Architecture, Suite -import json +try: + # python >= 2.6 + import json +except: + # python <= 2.5 + import simplejson as json + import re import unittest