summaryrefslogtreecommitdiff
path: root/django/core/cache
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-05-02 21:27:44 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2015-05-17 09:39:34 +0200
commit54026f1e8d0de7dbd0e718fe326ba12666a8d2e9 (patch)
treec36a9046caf916328b24d0c6422490b978c66b65 /django/core/cache
parentd9521f66b1851b0eacd55bc78f801dc64123e333 (diff)
Renamed value_to_db_xxx to adapt_xxxfield_value.
This mirrors convert_xxxfield_value nicely, taking advantage of the adapter/converter terminology which is commonly used by DB-API modules.
Diffstat (limited to 'django/core/cache')
-rw-r--r--django/core/cache/backends/db.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py
index 6b9716b430..5c8ef834f1 100644
--- a/django/core/cache/backends/db.py
+++ b/django/core/cache/backends/db.py
@@ -136,7 +136,7 @@ class DatabaseCache(BaseDatabaseCache):
current_expires = typecast_timestamp(str(current_expires))
if settings.USE_TZ:
current_expires = current_expires.replace(tzinfo=timezone.utc)
- exp = connections[db].ops.value_to_db_datetime(exp)
+ exp = connections[db].ops.adapt_datetimefield_value(exp)
if result and (mode == 'set' or (mode == 'add' and current_expires < now)):
cursor.execute("UPDATE %s SET value = %%s, expires = %%s "
"WHERE cache_key = %%s" % table,
@@ -177,7 +177,7 @@ class DatabaseCache(BaseDatabaseCache):
with connections[db].cursor() as cursor:
cursor.execute("SELECT cache_key FROM %s "
"WHERE cache_key = %%s and expires > %%s" % table,
- [key, connections[db].ops.value_to_db_datetime(now)])
+ [key, connections[db].ops.adapt_datetimefield_value(now)])
return cursor.fetchone() is not None
def _cull(self, db, cursor, now):
@@ -188,7 +188,7 @@ class DatabaseCache(BaseDatabaseCache):
now = now.replace(tzinfo=None)
table = connections[db].ops.quote_name(self._table)
cursor.execute("DELETE FROM %s WHERE expires < %%s" % table,
- [connections[db].ops.value_to_db_datetime(now)])
+ [connections[db].ops.adapt_datetimefield_value(now)])
cursor.execute("SELECT COUNT(*) FROM %s" % table)
num = cursor.fetchone()[0]
if num > self._max_entries: