From c11686844dfac796dc642c7d8d32a54021f55b21 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 6 Apr 2011 09:54:55 +0200 Subject: [PATCH] reviewed imports, tolerant on some that are hard to get on a mac --- sfa/util/PostgreSQL.py | 16 ++++++++++------ sfa/util/soapprotocol.py | 3 +-- sfatables/xmlrule.py | 6 +++++- 3 files changed, 16 insertions(+), 9 deletions(-) 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: -- 2.43.0