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
c1b221a9
Kaydet (Commit)
c1b221a9
authored
Ara 23, 2016
tarafından
Adam Chainz
Kaydeden (comit)
Tim Graham
Ara 23, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27625 -- Made LazySettings cache attributes in __dict__.
üst
8669cf0e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
__init__.py
django/conf/__init__.py
+24
-1
No files found.
django/conf/__init__.py
Dosyayı görüntüle @
c1b221a9
...
@@ -49,9 +49,32 @@ class LazySettings(LazyObject):
...
@@ -49,9 +49,32 @@ class LazySettings(LazyObject):
}
}
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
"""
Return the value of a setting and cache it in self.__dict__.
"""
if
self
.
_wrapped
is
empty
:
if
self
.
_wrapped
is
empty
:
self
.
_setup
(
name
)
self
.
_setup
(
name
)
return
getattr
(
self
.
_wrapped
,
name
)
val
=
getattr
(
self
.
_wrapped
,
name
)
self
.
__dict__
[
name
]
=
val
return
val
def
__setattr__
(
self
,
name
,
value
):
"""
Set the value of setting. Clear all cached values if _wrapped changes
(@override_settings does this) or clear single values when set.
"""
if
name
==
'_wrapped'
:
self
.
__dict__
.
clear
()
else
:
self
.
__dict__
.
pop
(
name
,
None
)
super
(
LazySettings
,
self
)
.
__setattr__
(
name
,
value
)
def
__delattr__
(
self
,
name
):
"""
Delete a setting and clear it from cache if needed.
"""
super
(
LazySettings
,
self
)
.
__delattr__
(
name
)
self
.
__dict__
.
pop
(
name
,
None
)
def
configure
(
self
,
default_settings
=
global_settings
,
**
options
):
def
configure
(
self
,
default_settings
=
global_settings
,
**
options
):
"""
"""
...
...
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