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

Modified Files:
        pgdb.py 
Log Message:
Use newer style when raising exceptions (this works with all Py 2.x as well).
To see the diffs for this commit:
   
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/pgdb.py.diff?r1=1.37&r2=1.38

Index: pgdb.py
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/pgdb.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- pgdb.py     16 Sep 2008 22:29:47 -0000      1.37
+++ pgdb.py     10 Oct 2008 05:49:34 -0000      1.38
@@ -4,7 +4,7 @@
 #
 # Written by D'Arcy J.M. Cain
 #
-# $Id: pgdb.py,v 1.37 2008/09/16 22:29:47 cito Exp $
+# $Id: pgdb.py,v 1.38 2008/10/10 05:49:34 cito Exp $
 #
 
 """pgdb - DB-API 2.0 compliant module for PygreSQL.
@@ -207,7 +207,7 @@
                                try:
                                        self._cnx.source().execute(sql)
                                except:
-                                       raise OperationalError, "can't start 
transaction"
+                                       raise OperationalError("can't start 
transaction")
                                self._dbcnx._tnx = 1
                        for params in param_seq:
                                if params:
@@ -220,11 +220,11 @@
                                else:
                                        self.rowcount = -1
                except Error, msg:
-                       raise DatabaseError, "error '%s' in '%s'" % (msg, sql)
+                       raise DatabaseError("error '%s' in '%s'" % (msg, sql))
                except Exception, err:
-                       raise OperationalError, "internal error in '%s': %s" % 
(sql, err)
+                       raise OperationalError("internal error in '%s': %s" % 
(sql, err))
                except:
-                       raise OperationalError, "internal error in '%s'" % sql
+                       raise OperationalError("internal error in '%s'" % sql)
                # then initialize result raw count and description
                if self._src.resulttype == RESULT_DQL:
                        self.rowcount = self._src.ntuples
@@ -261,7 +261,7 @@
                try:
                        res = self._src.fetch(size)
                except Error, e:
-                       raise DatabaseError, str(e)
+                       raise DatabaseError(str(e))
                result = []
                for r in res:
                        row = []
@@ -271,7 +271,7 @@
                return result
 
        def nextset(self):
-               raise NotSupportedError, "nextset() is not supported"
+               raise NotSupportedError("nextset() is not supported")
 
        def setinputsizes(self, sizes):
                pass
@@ -303,7 +303,7 @@
        elif hasattr(x, '__pg_repr__'):
                x = x.__pg_repr__()
        else:
-               raise InterfaceError, 'do not know how to handle type %s' % 
type(x)
+               raise InterfaceError('do not know how to handle type %s' % 
type(x))
        return x
 
 
@@ -326,14 +326,14 @@
                try:
                        self._cnx.source()
                except:
-                       raise OperationalError, "invalid connection"
+                       raise OperationalError("invalid connection")
 
        def close(self):
                if self._cnx:
                        self._cnx.close()
                        self._cnx = None
                else:
-                       raise OperationalError, "connection has been closed"
+                       raise OperationalError("connection has been closed")
 
        def commit(self):
                if self._cnx:
@@ -342,9 +342,9 @@
                                try:
                                        self._cnx.source().execute("COMMIT")
                                except:
-                                       raise OperationalError, "can't commit"
+                                       raise OperationalError("can't commit")
                else:
-                       raise OperationalError, "connection has been closed"
+                       raise OperationalError("connection has been closed")
 
        def rollback(self):
                if self._cnx:
@@ -353,18 +353,18 @@
                                try:
                                        self._cnx.source().execute("ROLLBACK")
                                except:
-                                       raise OperationalError, "can't rollback"
+                                       raise OperationalError("can't rollback")
                else:
-                       raise OperationalError, "connection has been closed"
+                       raise OperationalError("connection has been closed")
 
        def cursor(self):
                if self._cnx:
                        try:
                                return pgdbCursor(self)
                        except:
-                               raise OperationalError, "invalid connection"
+                               raise OperationalError("invalid connection")
                else:
-                       raise OperationalError, "connection has been closed"
+                       raise OperationalError("connection has been closed")
 
 
 ### Module Interface

_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql

Reply via email to