[PyGreSQL] [CVS] Change to pygresql: pgdb.py, pgmodule.c

Christoph Zwerschke cito at druid.net
Fri Nov 21 17:06:34 EST 2008


Update of /usr/cvs/Public/pygresql/module
In directory druid.net:/tmp/cvs-serv27195

Modified Files:
	pgdb.py pgmodule.c 
Log Message:
Allow connect() without passing a dsn.
To see the diffs for this commit:
   http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/pgdb.py.diff?r1=1.49&r2=1.50

Index: pgdb.py
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/pgdb.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- pgdb.py	21 Nov 2008 21:30:58 -0000	1.49
+++ pgdb.py	21 Nov 2008 22:06:34 -0000	1.50
@@ -4,7 +4,7 @@
 #
 # Written by D'Arcy J.M. Cain
 #
-# $Id: pgdb.py,v 1.49 2008/11/21 21:30:58 cito Exp $
+# $Id: pgdb.py,v 1.50 2008/11/21 22:06:34 cito Exp $
 #
 
 """pgdb - DB-API 2.0 compliant module for PygreSQL.
@@ -431,7 +431,7 @@
         dbpasswd = params[3]
         dbopt = params[4]
         dbtty = params[5]
-    except (IndexError, TypeError):
+    except (AttributeError, IndexError, TypeError):
         pass
 
     # override if necessary
@@ -446,7 +446,7 @@
             params = host.split(":")
             dbhost = params[0]
             dbport = int(params[1])
-        except (IndexError, TypeError, ValueError):
+        except (AttributeError, IndexError, TypeError, ValueError):
             pass
 
     # empty host is localhost

   http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/pgmodule.c.diff?r1=1.85&r2=1.86

Index: pgmodule.c
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/pgmodule.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- pgmodule.c	21 Nov 2008 19:25:27 -0000	1.85
+++ pgmodule.c	21 Nov 2008 22:06:34 -0000	1.86
@@ -1,5 +1,5 @@
 /*
- * $Id: pgmodule.c,v 1.85 2008/11/21 19:25:27 cito Exp $
+ * $Id: pgmodule.c,v 1.86 2008/11/21 22:06:34 cito Exp $
  * PyGres, version 2.2 A Python interface for PostgreSQL database. Written by
  * D'Arcy J.M. Cain, (darcy at druid.net).  Based heavily on code written by
  * Pascal Andre, andre at chimay.via.ecp.fr. Copyright (c) 1995, Pascal Andre
@@ -540,7 +540,7 @@
 	Py_END_ALLOW_THREADS
 
 	/* checks result validity */
-		if (!self->last_result)
+	if (!self->last_result)
 	{
 		PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->pgcnx->cnx));
 		return NULL;
@@ -549,9 +549,9 @@
 	/* checks result status */
 	switch (PQresultStatus(self->last_result))
 	{
-			long		num_rows;
+		long	num_rows;
 
-			/* query succeeded */
+		/* query succeeded */
 		case PGRES_TUPLES_OK:	/* DQL: returns None (DB-SIG compliant) */
 			self->result_type = RESULT_DQL;
 			self->max_row = PQntuples(self->last_result);
@@ -571,7 +571,7 @@
 			}
 			return PyInt_FromLong(num_rows);
 
-			/* query failed */
+		/* query failed */
 		case PGRES_EMPTY_QUERY:
 			PyErr_SetString(PyExc_ValueError, "empty query.");
 			break;
@@ -2269,7 +2269,7 @@
 	Py_END_ALLOW_THREADS
 
 	/* checks result validity */
-		if (!result)
+	if (!result)
 	{
 		PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->cnx));
 		return NULL;



More information about the PyGreSQL mailing list