Fixed #9814 -- Allowed SafeStrings to be saved to sqlite DB when running on Python 2.6.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b58a260c56
commit
5f78eff909
|
@ -10,6 +10,7 @@ from django.db.backends import *
|
||||||
from django.db.backends.sqlite3.client import DatabaseClient
|
from django.db.backends.sqlite3.client import DatabaseClient
|
||||||
from django.db.backends.sqlite3.creation import DatabaseCreation
|
from django.db.backends.sqlite3.creation import DatabaseCreation
|
||||||
from django.db.backends.sqlite3.introspection import DatabaseIntrospection
|
from django.db.backends.sqlite3.introspection import DatabaseIntrospection
|
||||||
|
from django.utils.safestring import SafeString
|
||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
|
@ -49,6 +50,7 @@ if Database.version_info >= (2,4,1):
|
||||||
# slow-down, this adapter is only registered for sqlite3 versions
|
# slow-down, this adapter is only registered for sqlite3 versions
|
||||||
# needing it.
|
# needing it.
|
||||||
Database.register_adapter(str, lambda s:s.decode('utf-8'))
|
Database.register_adapter(str, lambda s:s.decode('utf-8'))
|
||||||
|
Database.register_adapter(SafeString, lambda s:s.decode('utf-8'))
|
||||||
|
|
||||||
class DatabaseFeatures(BaseDatabaseFeatures):
|
class DatabaseFeatures(BaseDatabaseFeatures):
|
||||||
# SQLite cannot handle us only partially reading from a cursor's result set
|
# SQLite cannot handle us only partially reading from a cursor's result set
|
||||||
|
|
Loading…
Reference in New Issue