From 2c76e10042115760eed33fce79a9917d006118bf Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Sun, 23 Jan 2011 21:53:13 +0100 Subject: [PATCH] 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 --- daklib/dbconn.py | 9 ++++++++- tests/dbtest_ormobject.py | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) 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 -- 2.39.5