Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16808, removed some dead code from teh ORM. Thanks to aaugusti…

…n for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit efb832744466548ea6f86fa027ffe702baa0d9a0 1 parent eb29758
Alex Gaynor authored September 10, 2011
8  django/db/backends/util.py
@@ -102,11 +102,6 @@ def typecast_timestamp(s): # does NOT store time zone information
102 102
     return datetime.datetime(int(dates[0]), int(dates[1]), int(dates[2]),
103 103
         int(times[0]), int(times[1]), int(seconds), int((microseconds + '000000')[:6]))
104 104
 
105  
-def typecast_boolean(s):
106  
-    if s is None: return None
107  
-    if not s: return False
108  
-    return str(s)[0].lower() == 't'
109  
-
110 105
 def typecast_decimal(s):
111 106
     if s is None or s == '':
112 107
         return None
@@ -116,9 +111,6 @@ def typecast_decimal(s):
116 111
 # Converters from Python to database (string) #
117 112
 ###############################################
118 113
 
119  
-def rev_typecast_boolean(obj, d):
120  
-    return obj and '1' or '0'
121  
-
122 114
 def rev_typecast_decimal(d):
123 115
     if d is None:
124 116
         return None
12  tests/regressiontests/db_typecasts/tests.py
... ...
@@ -1,7 +1,10 @@
1 1
 # Unit tests for typecast functions in django.db.backends.util
2 2
 
  3
+import datetime
  4
+
3 5
 from django.db.backends import util as typecasts
4  
-import datetime, unittest
  6
+from django.utils import unittest
  7
+
5 8
 
6 9
 TEST_CASES = {
7 10
     'typecast_date': (
@@ -42,13 +45,6 @@
42 45
         ('2010-10-12 15:29:22.0632021', datetime.datetime(2010, 10, 12, 15, 29, 22, 63202)),
43 46
         ('2010-10-12 15:29:22.0632029', datetime.datetime(2010, 10, 12, 15, 29, 22, 63202)),
44 47
     ),
45  
-    'typecast_boolean': (
46  
-        (None, None),
47  
-        ('', False),
48  
-        ('t', True),
49  
-        ('f', False),
50  
-        ('x', False),
51  
-    ),
52 48
 }
53 49
 
54 50
 class DBTypeCasts(unittest.TestCase):

0 notes on commit efb8327

Please sign in to comment.
Something went wrong with that request. Please try again.