diff options
| author | Tim Graham <timograham@gmail.com> | 2017-07-06 13:18:05 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-07-20 16:30:08 -0400 |
| commit | 487362fa8f23d41de4db58e7408e66eb36399af0 (patch) | |
| tree | 25897a03c885d44a15860f59c121f0b6fab3e4a8 /django/core/cache | |
| parent | 8d5095d8a33824e02c95ee44d6e5acdb4b39e7ed (diff) | |
Fixed #28370 -- Deprecated the context arg of Field.from_db_value() and Expression.convert_value().
Unused since a0d166306fbdc41f49e6fadf4ec84b17eb147daa.
Diffstat (limited to 'django/core/cache')
| -rw-r--r-- | django/core/cache/backends/db.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py index 50d897b621..576d711a67 100644 --- a/django/core/cache/backends/db.py +++ b/django/core/cache/backends/db.py @@ -8,6 +8,7 @@ from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.db import DatabaseError, connections, models, router, transaction from django.utils import timezone from django.utils.encoding import force_bytes +from django.utils.inspect import func_supports_parameter class Options: @@ -64,7 +65,10 @@ class DatabaseCache(BaseDatabaseCache): expression = models.Expression(output_field=models.DateTimeField()) for converter in (connection.ops.get_db_converters(expression) + expression.get_db_converters(connection)): - expires = converter(expires, expression, connection, {}) + if func_supports_parameter(converter, 'context'): # RemovedInDjango30Warning + expires = converter(expires, expression, connection, {}) + else: + expires = converter(expires, expression, connection) if expires < timezone.now(): db = router.db_for_write(self.cache_model_class) @@ -126,7 +130,10 @@ class DatabaseCache(BaseDatabaseCache): expression = models.Expression(output_field=models.DateTimeField()) for converter in (connection.ops.get_db_converters(expression) + expression.get_db_converters(connection)): - current_expires = converter(current_expires, expression, connection, {}) + if func_supports_parameter(converter, 'context'): # RemovedInDjango30Warning + current_expires = converter(current_expires, expression, connection, {}) + else: + current_expires = converter(current_expires, expression, connection) exp = connection.ops.adapt_datetimefield_value(exp) if result and (mode == 'set' or (mode == 'add' and current_expires < now)): |
