From 757400f82ff079f029cf2e11536c13d6199f832d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 4 Aug 2011 15:34:24 -0400 Subject: - Ensured that the same ValueError is raised for illegal date/time/datetime string parsed from the database regardless of whether C extensions are in use or not. --- lib/sqlalchemy/processors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/processors.py') diff --git a/lib/sqlalchemy/processors.py b/lib/sqlalchemy/processors.py index cb5f00bde..dd789a44e 100644 --- a/lib/sqlalchemy/processors.py +++ b/lib/sqlalchemy/processors.py @@ -24,7 +24,10 @@ def str_to_datetime_processor_factory(regexp, type_): if value is None: return None else: - return type_(*map(int, rmatch(value).groups(0))) + m = rmatch(value) + if m is None: + raise ValueError("Couldn't parse %s string." % type_.__name__) + return type_(*map(int, m.groups(0))) return process def boolean_to_int(value): -- cgit v1.2.1