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

Поиск
Список
Период
Сортировка
От jwp@pgfoundry.org (James William Pye)
Тема python - ex: Fix bugs, and add/rename exceptions.
Дата
Msg-id 20050803231542.BCACA11263A2@pgfoundry.org
обсуждение исходный текст
Список 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)

В списке pgsql-committers по дате отправления:

Предыдущее
От: jwp@pgfoundry.org (James William Pye)
Дата:
Сообщение: python - ex: Add Mapping class, and fix codes.
Следующее
От: jwp@pgfoundry.org (James William Pye)
Дата:
Сообщение: python - ex: Add code and prime unittests.