From: Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Date: Wed, 6 Apr 2011 07:54:55 +0000 (+0200)
Subject: reviewed imports, tolerant on some that are hard to get on a mac
X-Git-Tag: sfa-1.0-21-ckp1~74^2~29
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c11686844dfac796dc642c7d8d32a54021f55b21;p=sfa.git

reviewed imports, tolerant on some that are hard to get on a mac
---

diff --git a/sfa/util/PostgreSQL.py b/sfa/util/PostgreSQL.py
index f2c51bfd..39cde57b 100644
--- a/sfa/util/PostgreSQL.py
+++ b/sfa/util/PostgreSQL.py
@@ -4,18 +4,22 @@
 #
 #
 
+import re
+import traceback
+import commands
+from pprint import pformat
+from types import StringTypes, NoneType
+
 import psycopg2
 import psycopg2.extensions
 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
 # UNICODEARRAY not exported yet
 psycopg2.extensions.register_type(psycopg2._psycopg.UNICODEARRAY)
 
-import pgdb
-from types import StringTypes, NoneType
-import traceback
-import commands
-import re
-from pprint import pformat
+# allow to run sfa2wsdl if this is missing (for mac)
+import sys
+try: import pgdb
+except: print >> sys.stderr, "WARNING, could not import pgdb"
 
 from sfa.util.faults import *
 from sfa.util.sfalogging import sfa_logger
diff --git a/sfa/util/soapprotocol.py b/sfa/util/soapprotocol.py
index 8d9b3d15..de3ee965 100644
--- a/sfa/util/soapprotocol.py
+++ b/sfa/util/soapprotocol.py
@@ -1,8 +1,7 @@
 # SOAP-specific code for SFA Client
 
-import pdb
-from ZSI.client import Binding
 from httplib import HTTPSConnection
+from ZSI.client import Binding
 
 def xmlrpc_like_callable (soap_callable, *x):
     soap_result = soap_callable(*x)
diff --git a/sfatables/xmlrule.py b/sfatables/xmlrule.py
index 52bea31e..e21f9d86 100644
--- a/sfatables/xmlrule.py
+++ b/sfatables/xmlrule.py
@@ -1,5 +1,9 @@
 import libxml2
-import libxslt
+# allow to run sfa2wsdl if this is missing (for mac)
+import sys
+try:import libxslt
+except: print >>sys.stderr, "WARNING, could not import libxslt"
+
 from sfatables.globals import *
 
 class XMLRule: