Skip to content
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

Keep the prior behavior of overwriting File.page #3381

Merged
merged 1 commit into from Sep 10, 2023
Merged

Keep the prior behavior of overwriting File.page #3381

merged 1 commit into from Sep 10, 2023

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Sep 10, 2023

unless the page value is a strict subclass of Page

@squidfunk @ultrabug

unless the page value is a *strict* subclass of Page
@squidfunk
Copy link
Sponsor Contributor

LGTM. So, the regressions that we've seen should be gone, but judging from the code, you decided to issue warnings if a plugin overwrites Page. Are we planning to switch to the behavior proposed in #3367 in MkDocs 1.6?

@oprypin
Copy link
Contributor Author

oprypin commented Sep 10, 2023

You'll be able to move forward with your plugin in 1.5.3 because you're working with strict subclasses and they're supported without warning. For other cases I kept old behavior and added warnings.

@squidfunk
Copy link
Sponsor Contributor

squidfunk commented Sep 10, 2023

Thanks, yes, I was asking what the plans for 1.6 were, because the warning is not entirely clear to me:

warnings.warn(
  "A plugin has set File.page to an instance of Page and it got overwritten. "
  "The behavior of this will change in MkDocs 1.6.",
  DeprecationWarning,
)

Will this be an error that terminates the build in MkDocs 1.6?

@oprypin
Copy link
Contributor Author

oprypin commented Sep 10, 2023

Here's the list of cases:

  • Strict subclass: 1.5.3 just accepts it and 1.6.0 still just accepts it
  • Page: 1.5.3 ignores/overwrites it with warning, 1.6.0 just accepts it   ← what you're asking about
  • Other type: 1.5.3 ignores/overwrites it with warning, 1.6.0 errors
  • None: always ignore/overwrite

@squidfunk
Copy link
Sponsor Contributor

Perfect, thanks!

Copy link
Member

@ultrabug ultrabug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks!

@oprypin oprypin merged commit 759e1e3 into master Sep 10, 2023
30 checks passed
@oprypin oprypin deleted the page2 branch September 10, 2023 11:05
oprypin added a commit that referenced this pull request Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants