Add get_spec
to IPackageOverrides
#3792
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on #3791, I ran into an issue: The cache buster was diving into the guts of
PackageOverrides
, stymying my attempts to refactor that.pyramid/src/pyramid/config/views.py
Lines 2338 to 2347 in eb0e01a
In particular,
get_path
andpkg_name
should be considered private membersPackageAssetSource
/FSAssetSource
, because they are undocumented and aren't directly tested.This PR is an attempt to formalize those into a public, tested method called
get_spec
.I also added
get_spec
to theIPackageOverrides
interface. This seemed necessary, as if we want to call that method after querying for the utility, it should be in the interface.This comes with some minor behavior changes as well: The original
_bust_asset_path
implementation did not check for file existence (it always took the first matching override source), whereas the new implementation does in order to match the behavior of overrides elsewhere.