-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Fixes #14155] Fixes parameter order for mdict to set precedence from settings.PYCSW to pycsw_local defaults #14162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,7 +46,7 @@ def csw_global_dispatch(request, dataset_filter=None, config_updater=None): | |||||||||
| if settings.CATALOGUE["default"]["ENGINE"] != "geonode.catalogue.backends.pycsw_local": | ||||||||||
| return HttpResponseRedirect(settings.CATALOGUE["default"]["URL"]) | ||||||||||
|
|
||||||||||
| mdict = dict(settings.PYCSW["CONFIGURATION"], **CONFIGURATION) | ||||||||||
| mdict = dict(CONFIGURATION, **settings.PYCSW["CONFIGURATION"]) | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shallow merge will cause the
Suggested change
|
||||||||||
| mdict = config_updater(mdict) if config_updater else mdict | ||||||||||
|
|
||||||||||
| access_token = None | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation performs a shallow merge, which causes the
serverdictionary to be completely replaced by the one insettings.PYCSW. This leads to a regression where default values defined inCONFIGURATION["server"](such asdomainquerytype) are lost if they are not explicitly redefined in the user settings.Furthermore, the original code (now commented out) had a bug where it mutated the global
CONFIGURATIONconstant becausedict()only creates a shallow copy, andupdate()modifies the dictionary in place.It is recommended to remove the commented-out code and use a merge strategy that preserves nested defaults and avoids mutating global constants.