Author serhiy.storchaka
Recipients belopolsky, bozo.kopic, ghaering, lemburg, serhiy.storchaka, xiang.zhang
Date 2017-01-13.10:21:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484302911.47.0.669066956696.issue29099@psf.upfronthosting.co.za>
In-reply-to
Content
I think ProgrammingError is not correct type of an exception. It is used for programming errors such as using uninitialized or closed objects or supplying incorrect number of bindings. But this error can be caused by invalid data in a database created not by Python. Currently converters raise ValueError or TypeError for invalid data. ValueError is raised for datetime without microseconds but with timezone offset. I think ValueError is more appropriate type for such errors.

Perhaps even TypeError should be converted to ValueError.

    try:
        # parsing date or datetime
    except (ValueError, TypeError):
        raise ValueError(...)
History
Date User Action Args
2017-01-13 10:21:51serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, ghaering, belopolsky, xiang.zhang, bozo.kopic
2017-01-13 10:21:51serhiy.storchakasetmessageid: <1484302911.47.0.669066956696.issue29099@psf.upfronthosting.co.za>
2017-01-13 10:21:51serhiy.storchakalinkissue29099 messages
2017-01-13 10:21:51serhiy.storchakacreate