summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Kelly <ian.g.kelly@gmail.com>2009-03-13 21:04:48 +0000
committerIan Kelly <ian.g.kelly@gmail.com>2009-03-13 21:04:48 +0000
commit83c1572cc47283b97c78a4b695788bcb755ca358 (patch)
tree31d03c4a1fd56ca9c00b967887818a54e8a800a5
parent0ae95f80b4030b6ad716838f45da45b9c34e612a (diff)
Fixed #10488: fixed DB cache backend test failures in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10051 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 4e81ec29f1..eb459a076d 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 1c057c3358..6dcc17f4f2 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -255,6 +255,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 return_insert_id(self):
"""
For backends that support returning the last insert ID as part
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 109ec5bd9f..6000e32f3a 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -123,6 +123,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)