[Fusionforge-commits] r9296 - trunk/plugins/coclico/mailman/usr/lib/mailman/Mailman

Christian Bayle cbayle at libremir.placard.fr.eu.org
Tue Mar 30 13:17:27 CEST 2010


Author: cbayle
Date: 2010-03-30 13:17:27 +0200 (Tue, 30 Mar 2010)
New Revision: 9296

Modified:
   trunk/plugins/coclico/mailman/usr/lib/mailman/Mailman/PsycopgConnector.py
Log:
Test if pgsql extension is present
Make db_connect use socket when possible


Modified: trunk/plugins/coclico/mailman/usr/lib/mailman/Mailman/PsycopgConnector.py
===================================================================
--- trunk/plugins/coclico/mailman/usr/lib/mailman/Mailman/PsycopgConnector.py	2010-03-30 08:37:16 UTC (rev 9295)
+++ trunk/plugins/coclico/mailman/usr/lib/mailman/Mailman/PsycopgConnector.py	2010-03-30 11:17:27 UTC (rev 9296)
@@ -27,14 +27,19 @@
 from Mailman import mm_cfg
 from Mailman import Utils
 from Mailman.Logging.Syslog import syslog
-import psycopg2
 
+
+
 class PsycopgConnector(ExternalConnector.ExternalConnector):
 	def __init__(self,mlist,param):
 		ExternalConnector.ExternalConnector.__init__(self,mlist,param)
 	def __db_connect__(self):
 		if mm_cfg.connection == 0:
-			if self._param['dbhost']:
+			try:
+				import psycopg2
+			except ImportError:
+				return False
+			if self._param['dbhost']<> "127.0.0.1" and self._param['dbhost']<> "127.0.1.1" and self._param['dbhost']<> "":
 				connection = psycopg2.connect (host = self._param['dbhost'], user = self._param['dbuser'], password = self._param['dbpassword'], database = self._param['database'])
 			else :
 				connection = psycopg2.connect (user = self._param['dbuser'], password = self._param['dbpassword'], database = self._param['database'])




More information about the Fusionforge-commits mailing list