Fix problème clés trop longues (cache)

This commit is contained in:
Jean-Marie Favreau 2024-11-15 16:38:44 +01:00
parent 3bd4ef5771
commit 79a73d6459

View File

@ -10,6 +10,7 @@ from django_ckeditor_5.fields import CKEditor5Field
from urllib.parse import urlparse from urllib.parse import urlparse
from django.core.cache import cache from django.core.cache import cache
import hashlib
import urllib.request import urllib.request
import os import os
from django.core.files import File from django.core.files import File
@ -216,6 +217,7 @@ class Tag(models.Model):
def get_tag_groups(nb_suggestions=10, exclude=False, include=False, all=False): def get_tag_groups(nb_suggestions=10, exclude=False, include=False, all=False):
id_cache = 'all_tags ' + str(exclude) + ' ' + str(include) + ' ' + str(nb_suggestions) id_cache = 'all_tags ' + str(exclude) + ' ' + str(include) + ' ' + str(nb_suggestions)
id_cache = hashlib.md5(id_cache.encode("utf8")).hexdigest()
result = cache.get(id_cache) result = cache.get(id_cache)
if not result: if not result: