Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
ac37c9e4
Kaydet (Commit)
ac37c9e4
authored
Agu 12, 2012
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[py3] Encoded value before feeding it to hashlib.md5
üst
99321e30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
filebased.py
django/core/cache/backends/filebased.py
+2
-1
cache.py
django/utils/cache.py
+3
-3
No files found.
django/core/cache/backends/filebased.py
Dosyayı görüntüle @
ac37c9e4
...
...
@@ -10,6 +10,7 @@ except ImportError:
import
pickle
from
django.core.cache.backends.base
import
BaseCache
from
django.utils.encoding
import
smart_bytes
class
FileBasedCache
(
BaseCache
):
def
__init__
(
self
,
dir
,
params
):
...
...
@@ -136,7 +137,7 @@ class FileBasedCache(BaseCache):
Thus, a cache key of "foo" gets turnned into a file named
``{cache-dir}ac/bd/18db4cc2f85cedef654fccc4a4d8``.
"""
path
=
hashlib
.
md5
(
key
)
.
hexdigest
()
path
=
hashlib
.
md5
(
smart_bytes
(
key
)
)
.
hexdigest
()
path
=
os
.
path
.
join
(
path
[:
2
],
path
[
2
:
4
],
path
[
4
:])
return
os
.
path
.
join
(
self
.
_dir
,
path
)
...
...
django/utils/cache.py
Dosyayı görüntüle @
ac37c9e4
...
...
@@ -23,7 +23,7 @@ import time
from
django.conf
import
settings
from
django.core.cache
import
get_cache
from
django.utils.encoding
import
iri_to_uri
,
force_text
from
django.utils.encoding
import
iri_to_uri
,
force_text
,
smart_bytes
from
django.utils.http
import
http_date
from
django.utils.timezone
import
get_current_timezone_name
from
django.utils.translation
import
get_language
...
...
@@ -180,14 +180,14 @@ def _generate_cache_key(request, method, headerlist, key_prefix):
value
=
request
.
META
.
get
(
header
,
None
)
if
value
is
not
None
:
ctx
.
update
(
value
)
path
=
hashlib
.
md5
(
iri_to_uri
(
request
.
get_full_path
(
)))
path
=
hashlib
.
md5
(
smart_bytes
(
iri_to_uri
(
request
.
get_full_path
()
)))
cache_key
=
'views.decorators.cache.cache_page.
%
s.
%
s.
%
s.
%
s'
%
(
key_prefix
,
method
,
path
.
hexdigest
(),
ctx
.
hexdigest
())
return
_i18n_cache_key_suffix
(
request
,
cache_key
)
def
_generate_cache_header_key
(
key_prefix
,
request
):
"""Returns a cache key for the header cache."""
path
=
hashlib
.
md5
(
iri_to_uri
(
request
.
get_full_path
(
)))
path
=
hashlib
.
md5
(
smart_bytes
(
iri_to_uri
(
request
.
get_full_path
()
)))
cache_key
=
'views.decorators.cache.cache_header.
%
s.
%
s'
%
(
key_prefix
,
path
.
hexdigest
())
return
_i18n_cache_key_suffix
(
request
,
cache_key
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment