python - ex: Fix bugs, and add/rename exceptions.

From: jwp(at)pgfoundry(dot)org (James William Pye)
To: pgsql-committers(at)postgresql(dot)org
Subject: python - ex: Fix bugs, and add/rename exceptions.
Date: 2005-08-03 23:15:42
Message-ID: 20050803231542.BCACA11263A2@pgfoundry.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Fix bugs, and add/rename exceptions. The previous implementation used a plain
dictionary to do the mapping of codes to exceptions, this implementation uses
the code.Mapping dictionary subtype to handle this. The get and set methods
provided by code.Mapping makes this process a bit easier.
Change the Message __init__ method to no longer validate that the code is
appropriate for the exception. This check made it difficult to allow
arbitrary codes to be used with Error and is probably more of a pain than a
blessing.

With this change the idea of the 'codes' attribute is gone. It was a pain, so
just go 1-to-1 for codes-to-exceptions. This really helps on useability as it is
not very Pythonic to have to check the 'code' of the exception after catching
it, and handling as needed after the check.

Notable new exceptions:
- The utility AbortTransaction
- Warning exceptions
- Information and Debug messages

Modified Files:
--------------
ex/src:
prime.py (r1.7 -> r1.8)
(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/python/ex/src/prime.py.diff?r1=1.7&r2=1.8)

Browse pgsql-committers by date

  From Date Subject
Next Message James William Pye 2005-08-03 23:20:40 python - ex: Add code and prime unittests.
Previous Message James William Pye 2005-08-03 22:52:36 python - ex: Add Mapping class, and fix codes.