MCPcopy
hub / github.com/django/django / __setattr__

Method __setattr__

django/conf/__init__.py:141–167  ·  view source on GitHub ↗

Set the value of setting. Clear all cached values if _wrapped changes (@override_settings does this) or clear single values when set.

(self, name, value)

Source from the content-addressed store, hash-verified

139 return val
140
141 def __setattr__(self, name, value):
142 """
143 Set the value of setting. Clear all cached values if _wrapped changes
144 (@override_settings does this) or clear single values when set.
145 """
146 if name == "_wrapped":
147 self.__dict__.clear()
148 else:
149 self.__dict__.pop(name, None)
150
151 # RemovedInDjango70Warning.
152 if name == "USE_BLANK_CHOICE_DASH":
153 _show_settings_deprecation_warning(
154 USE_BLANK_CHOICE_DASH_DEPRECATED_MSG, RemovedInDjango70Warning
155 )
156 # RemovedInDjango70Warning.
157 if name == "MAILERS":
158 # When MAILERS is set, clear any cached values of
159 # deprecated settings so that __getattr__() runs again for them.
160 for setting in DEPRECATED_EMAIL_SETTINGS:
161 self.__dict__.pop(setting, None)
162 if name in DEPRECATED_EMAIL_SETTINGS:
163 _show_settings_deprecation_warning(
164 EMAIL_SETTING_DEPRECATED_MSG.format(name=name), RemovedInDjango70Warning
165 )
166
167 super().__setattr__(name, value)
168
169 def __delattr__(self, name):
170 """Delete a setting and clear it from cache if needed."""

Callers 6

__setattr__Method · 0.45
__post_init__Method · 0.45
refreshMethod · 0.45
arefreshMethod · 0.45
_execute_taskMethod · 0.45
_store_resultMethod · 0.45

Calls 4

clearMethod · 0.45
popMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected