diff -ur -x.svn -x.mo -x'*.pyc' /home/pim/software/newforms/newforms-admin-7684/django/db/backends/mysql/base.py django/db/backends/mysql/base.py
old
|
new
|
|
3 | 3 | |
4 | 4 | Requires MySQLdb: http://sourceforge.net/projects/mysql-python |
5 | 5 | """ |
6 | | |
| 6 | import types |
7 | 7 | from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, BaseDatabaseOperations, util |
8 | 8 | try: |
9 | 9 | import MySQLdb as Database |
… |
… |
|
39 | 39 | # TIME columns as timedelta -- they are more like timedelta in terms of actual |
40 | 40 | # behavior as they are signed and include days -- and Django expects time, so |
41 | 41 | # we still need to override that. |
| 42 | |
| 43 | def mysql_typecast_boolean(s): |
| 44 | if s is None: return None |
| 45 | return int(s) == 1 |
| 46 | |
42 | 47 | django_conversions = conversions.copy() |
43 | 48 | django_conversions.update({ |
| 49 | types.BooleanType: util.rev_typecast_boolean, |
| 50 | FIELD_TYPE.TINY: mysql_typecast_boolean, |
44 | 51 | FIELD_TYPE.TIME: util.typecast_time, |
45 | 52 | FIELD_TYPE.DECIMAL: util.typecast_decimal, |
46 | 53 | FIELD_TYPE.NEWDECIMAL: util.typecast_decimal, |