Closed trasfract closed 1 year ago
Happy to accept a PR here, even if you can only get part way adding a test.
I have opened a PR for this issue. Don't hesitate and review it :-) Happy to get some feedback
@adamchainz Hello! Did you get a chance to have a look at the PR I have opened to solve this issue? https://github.com/adamchainz/django-perf-rec/pull/545
Please don't make such "nudge" comments, they aren't helpful. I do open source when I can.
Python Version
3.9.16
Django Version
3.2.16
Package Version
4.21.0
Description
The django.core.cache definition of set_cache allows the naming of all parameters.
cache.set(key="key", value="value")
is therefore acceptableSee https://docs.djangoproject.com/en/3.2/topics/cache/#django.core.caches.cache.set
However, django_perf_rec's current implementation is incompatible with this approach as it directly accesses
args[0]
and considers it as the "key" parameter.In
cache.py
, the line which I believe is faulty is the following:key_or_keys = args[0]
This should be replaced with a more robust approach:key_or_keys = args[0] if args else kwargs['key']
or, better yet(?) declarekey
as a named parameter directly in the parameters of the function overload.