MCPcopy
hub / github.com/django/django / enable

Method enable

django/test/utils.py:497–521  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

495 super().__init__()
496
497 def enable(self):
498 # Keep this code at the beginning to leave the settings unchanged
499 # in case it raises an exception because INSTALLED_APPS is invalid.
500 if "INSTALLED_APPS" in self.options:
501 try:
502 apps.set_installed_apps(self.options["INSTALLED_APPS"])
503 except Exception:
504 apps.unset_installed_apps()
505 raise
506 override = UserSettingsHolder(settings._wrapped)
507 for key, new_value in self.options.items():
508 setattr(override, key, new_value)
509 self.wrapped = settings._wrapped
510 settings._wrapped = override
511 for key, new_value in self.options.items():
512 try:
513 setting_changed.send(
514 sender=settings._wrapped.__class__,
515 setting=key,
516 value=new_value,
517 enter=True,
518 )
519 except Exception as exc:
520 self.enable_exception = exc
521 self.disable()
522
523 def disable(self):
524 if "INSTALLED_APPS" in self.options:

Callers

nothing calls this directly

Calls 6

disableMethod · 0.95
UserSettingsHolderClass · 0.90
set_installed_appsMethod · 0.80
unset_installed_appsMethod · 0.80
itemsMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected