[Collab-qa-commits] r1351 - udd/udd

lucas at alioth.debian.org lucas at alioth.debian.org
Fri Dec 19 13:30:01 UTC 2008


Author: lucas
Date: 2008-12-19 13:30:01 +0000 (Fri, 19 Dec 2008)
New Revision: 1351

Modified:
   udd/udd/aux.py
   udd/udd/bugs_gatherer.pl
Log:
pass the db port when connecting.

Modified: udd/udd/aux.py
===================================================================
--- udd/udd/aux.py	2008-12-19 13:27:11 UTC (rev 1350)
+++ udd/udd/aux.py	2008-12-19 13:30:01 UTC (rev 1351)
@@ -30,7 +30,11 @@
 
 def open_connection(config):
   """Open the connection to the database and return it"""
-  return psycopg2.connect("dbname=" + config['general']['dbname'])
+  if config['general']['dbport']:
+    p = " port=" + str(config['general']['dbport'])
+  else:
+    p = ""
+  return psycopg2.connect("dbname=" + config['general']['dbname'] + p)
 
 __locks = {}
 def lock(config, source):

Modified: udd/udd/bugs_gatherer.pl
===================================================================
--- udd/udd/bugs_gatherer.pl	2008-12-19 13:27:11 UTC (rev 1350)
+++ udd/udd/bugs_gatherer.pl	2008-12-19 13:30:01 UTC (rev 1351)
@@ -304,8 +304,14 @@
 	my $source = $ARGV[2];
 
 	my $dbname = $config->{general}->{dbname};
+	my $dbport;
+	if ($config->{general}->{dbport} ne '') {
+	  $dbport = ";port=".$config->{general}->{dbport};
+	} else {
+	  $dbport = "";
+	}
 	# Connection to DB
-	my $dbh = DBI->connect("dbi:Pg:dbname=$dbname");
+	my $dbh = DBI->connect("dbi:Pg:dbname=$dbname".$dbport);
 	# We want to commit the transaction as a hole at the end
 	$dbh->{AutoCommit} = 0;
 	$dbh->do('SET CONSTRAINTS ALL DEFERRED');




More information about the Collab-qa-commits mailing list