From bb96e5577a4e9757443ccdc2837fdd3e335dd4d8 Mon Sep 17 00:00:00 2001 From: adustman Date: Fri, 29 Oct 2004 01:50:34 +0000 Subject: [PATCH] Fix bug #1045512 --- MySQLdb/MySQLdb/converters.py | 6 ++++++ MySQLdb/MySQLdb/pytimes.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MySQLdb/MySQLdb/converters.py b/MySQLdb/MySQLdb/converters.py index acc684d..04d28b1 100644 --- a/MySQLdb/MySQLdb/converters.py +++ b/MySQLdb/MySQLdb/converters.py @@ -132,3 +132,9 @@ conversions = { (None, None), ], } + +try: + from decimal import Decimal + conversions[FIELD_TYPE.DECIMAL] = Decimal +except ImportError: + pass diff --git a/MySQLdb/MySQLdb/pytimes.py b/MySQLdb/MySQLdb/pytimes.py index 2f905ff..cc0f023 100644 --- a/MySQLdb/MySQLdb/pytimes.py +++ b/MySQLdb/MySQLdb/pytimes.py @@ -37,13 +37,13 @@ def DateTime_or_None(s): elif 'T' in s: sep = 'T' else: - return None + return Date_or_None(s) try: d, t = s.split(sep, 1) return datetime(*[ int(x) for x in d.split('-')+t.split(':') ]) except: - return None + return Date_or_None(s) def TimeDelta_or_None(s): from math import modf