kopia lustrzana https://github.com/wagtail/wagtail
Don't redundantly try and find a site
We don't actually use the site. In all cases, it's sensible to fall back to passing the request instead, as this should improve cache ratiospull/10469/head
rodzic
13672a1e7c
commit
f5187d1938
|
@ -42,6 +42,7 @@ Changelog
|
|||
* Maintenance: Split out a base listing view from generic index view (Matt Westcott)
|
||||
* Maintenance: Update type hints in admin/ui/components.py so that `parent_context` is mutable (Andreas Nüßlein)
|
||||
* Maintenance: Deprecate `UserPagePermissionsProxy` (Sage Abdullah)
|
||||
* Maintenance: Optimise the Settings context processor to avoid redundantly finding a Site to improve cache ratios (Jake Howard)
|
||||
|
||||
|
||||
5.0.2 (21.06.2023)
|
||||
|
|
|
@ -63,6 +63,7 @@ FieldPanels can now be marked as read-only with the `read_only=True` keyword arg
|
|||
* Split out a base listing view from generic index view (Matt Westcott)
|
||||
* Update type hints in admin/ui/components.py so that `parent_context` is mutable (Andreas Nüßlein)
|
||||
* Deprecate `UserPagePermissionsProxy` (Sage Abdullah)
|
||||
* Optimise the Settings context processor to avoid redundantly finding a Site to improve cache ratios (Jake Howard)
|
||||
|
||||
|
||||
## Upgrade considerations
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from wagtail.contrib.settings.models import BaseGenericSetting, BaseSiteSetting
|
||||
from wagtail.models import Site
|
||||
|
||||
|
@ -74,12 +72,4 @@ class SettingModuleProxy(dict):
|
|||
|
||||
|
||||
def settings(request):
|
||||
# Delay query until settings values are needed
|
||||
def _inner(request):
|
||||
site = Site.find_for_request(request)
|
||||
if site is None:
|
||||
return SettingProxy(request_or_site=None)
|
||||
|
||||
return SettingProxy(request_or_site=request)
|
||||
|
||||
return {"settings": SimpleLazyObject(lambda: _inner(request))}
|
||||
return {"settings": SettingProxy(request_or_site=request)}
|
||||
|
|
Ładowanie…
Reference in New Issue