1
0
mirror of synced 2024-11-12 01:00:46 +01:00

Fix our cache key generation when involving API clients.

This commit is contained in:
Jennifer Taylor 2024-06-28 00:14:27 +00:00
parent fce3b9ca17
commit c6477861ec

View File

@ -54,15 +54,20 @@ class APIClient:
def __repr__(self) -> str:
# Specifically defined so that two different instances of the same API client
# cache under the same key, as we want to share results from a given server
# to all local requests.
return (
# to all local requests. We also have to be sensitive to any control character
# limitations for memcached.
repr_val = (
"APIClient("
+ f"base_uri={self.base_uri!r}, "
+ f"token={self.token!r}, "
+ f"allow_stats={self.allow_stats!r}, "
+ f"base_uri={self.base_uri!r},"
+ f"token={self.token!r},"
+ f"allow_stats={self.allow_stats!r},"
+ f"allow_scores={self.allow_scores!r}"
+ ")"
)
repr_val = repr_val.replace(" ", "_")
repr_val = repr_val.replace("\r", "_")
repr_val = repr_val.replace("\n", "_")
return repr_val
def _content_type_valid(self, content_type: str) -> bool:
if ";" in content_type: