Author: Alex
Date: 2011-09-10 10:38:58 -0700 (Sat, 10 Sep 2011)
New Revision: 16782
Modified:
django/trunk/django/db/backends/util.py
django/trunk/tests/regressiontests/db_typecasts/tests.py
Log:
Fixed #16808, removed some dead code from teh ORM. Thanks to aaugustin for the
patch.
Modified: django/trunk/django/db/backends/util.py
===================================================================
--- django/trunk/django/db/backends/util.py 2011-09-10 17:29:33 UTC (rev
16781)
+++ django/trunk/django/db/backends/util.py 2011-09-10 17:38:58 UTC (rev
16782)
@@ -102,11 +102,6 @@
return datetime.datetime(int(dates[0]), int(dates[1]), int(dates[2]),
int(times[0]), int(times[1]), int(seconds), int((microseconds +
'000000')[:6]))
-def typecast_boolean(s):
- if s is None: return None
- if not s: return False
- return str(s)[0].lower() == 't'
-
def typecast_decimal(s):
if s is None or s == '':
return None
@@ -116,9 +111,6 @@
# Converters from Python to database (string) #
###############################################
-def rev_typecast_boolean(obj, d):
- return obj and '1' or '0'
-
def rev_typecast_decimal(d):
if d is None:
return None
Modified: django/trunk/tests/regressiontests/db_typecasts/tests.py
===================================================================
--- django/trunk/tests/regressiontests/db_typecasts/tests.py 2011-09-10
17:29:33 UTC (rev 16781)
+++ django/trunk/tests/regressiontests/db_typecasts/tests.py 2011-09-10
17:38:58 UTC (rev 16782)
@@ -1,8 +1,11 @@
# Unit tests for typecast functions in django.db.backends.util
+import datetime
+
from django.db.backends import util as typecasts
-import datetime, unittest
+from django.utils import unittest
+
TEST_CASES = {
'typecast_date': (
('', None),
@@ -42,13 +45,6 @@
('2010-10-12 15:29:22.0632021', datetime.datetime(2010, 10, 12, 15,
29, 22, 63202)),
('2010-10-12 15:29:22.0632029', datetime.datetime(2010, 10, 12, 15,
29, 22, 63202)),
),
- 'typecast_boolean': (
- (None, None),
- ('', False),
- ('t', True),
- ('f', False),
- ('x', False),
- ),
}
class DBTypeCasts(unittest.TestCase):
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.