Anonymous avatar Anonymous committed 07b612e

Fix for ticket [923]

Comments (0)

Files changed (1)

lib/sqlalchemy/databases/mssql.py

 
     def bind_processor(self, dialect):
         def process(value):
-            if isinstance(value, datetime.datetime):
+            if type(value) is datetime.datetime:
                 value = datetime.datetime.combine(self.__zero_date, value.time())
-            elif isinstance(value, datetime.time):
+            elif type(value) is datetime.time:
                 value = datetime.datetime.combine(self.__zero_date, value)
             return value
         return process
     
     def result_processor(self, dialect):
         def process(value):
-            if isinstance(value, datetime.datetime):
+            if type(value) is datetime.datetime:
                 return value.time()
-            elif isinstance(value, datetime.date):
+            elif type(value) is datetime.date:
                 return datetime.time(0, 0, 0)
             return value
         return process
         def process(value):
             # adodbapi will return datetimes with empty time values as datetime.date() objects.
             # Promote them back to full datetime.datetime()
-            if value and isinstance(value, datetime.date):
+            if type(value) is datetime.date:
                 return datetime.datetime(value.year, value.month, value.day)
             return value
         return process
 class MSDateTime_pyodbc(MSDateTime):
     def bind_processor(self, dialect):
         def process(value):
-            if value and isinstance(value, datetime.date):
+            if type(value) is datetime.date:
                 return datetime.datetime(value.year, value.month, value.day)
-            else:
-                return value
+            return value
         return process
         
 class MSDate_pyodbc(MSDate):
     def bind_processor(self, dialect):
         def process(value):
-            if value and isinstance(value, datetime.date):
+            if type(value) is datetime.date:
                 return datetime.datetime(value.year, value.month, value.day)
-            else:
-                return value
+            return value
         return process
     
     def result_processor(self, dialect):
         def process(value):
             # pyodbc returns SMALLDATETIME values as datetime.datetime(). truncate it back to datetime.date()
-            if value and isinstance(value, datetime.datetime):
+            if type(value) is datetime.datetime:
                 return value.date()
-            else:
-                return value
+            return value
         return process
         
 class MSDate_pymssql(MSDate):
     def result_processor(self, dialect):
         def process(value):
             # pymssql will return SMALLDATETIME values as datetime.datetime(), truncate it back to datetime.date()
-            if value and isinstance(value, datetime.datetime):
+            if type(value) is datetime.datetime:
                 return value.date()
-            else:
-                return value
+            return value
         return process
         
 class MSText(sqltypes.Text):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.