summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Kelly <ian.g.kelly@gmail.com>2009-03-13 21:07:41 +0000
committerIan Kelly <ian.g.kelly@gmail.com>2009-03-13 21:07:41 +0000
commit0eac35ce119f108d2ffaeea745101cc3c4a85b98 (patch)
tree2efc5887b167c789916dc09cc4d54fd310eaa16a
parent0ced9f68f3d8df6d09f538101c8cf94511a199f0 (diff)
[1.0.X] Fixed #10488: fixed DB cache backend test failures in Oracle. Backport of [10051] from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/cache/backends/db.py3
-rw-r--r--django/db/backends/__init__.py7
-rw-r--r--django/db/backends/oracle/base.py5
3 files changed, 14 insertions, 1 deletions
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py
index 06a99d11a6..f153993117 100644
--- a/django/core/cache/backends/db.py
+++ b/django/core/cache/backends/db.py
@@ -35,7 +35,8 @@ class CacheClass(BaseCache):
cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % self._table, [key])
transaction.commit_unless_managed()
return default
- return pickle.loads(base64.decodestring(row[1]))
+ value = connection.ops.process_clob(row[1])
+ return pickle.loads(base64.decodestring(value))
def set(self, key, value, timeout=None):
self._base_set('set', key, value, timeout)
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 353eb39488..aa9e3e0310 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -212,6 +212,13 @@ class BaseDatabaseOperations(object):
"""
return 'DEFAULT'
+ def process_clob(self, value):
+ """
+ Returns the value of a CLOB column, for backends that return a locator
+ object that requires additional processing.
+ """
+ return value
+
def query_class(self, DefaultQueryClass):
"""
Given the default Query class, returns a custom Query class
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index a2b1196d85..be1c497898 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -115,6 +115,11 @@ WHEN (new.%(col_name)s IS NULL)
def prep_for_iexact_query(self, x):
return x
+ def process_clob(self, value):
+ if value is None:
+ return u''
+ return force_unicode(value.read())
+
def query_class(self, DefaultQueryClass):
return query.query_class(DefaultQueryClass, Database)