[dak/master] 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 <twerner@debian.org>
---
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 846addd..1364539 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 a5b7755..d1c72de 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
--
1.5.6.5
Reply to: