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

Add jbotDeprecated directive with dictionary as single argument. #20

Merged
merged 12 commits into from
Feb 12, 2025

Conversation

mauritsvanrees
Copy link
Member

This can be used when you move templates and want an existing jbot override for the old template path to still work.

Example:

  • You move old_package/test.pt to new_package/test.pt.
  • You register a dictionary with: {"old_package.test.pt": "new_package.test.pt"}
  • If a third party package has a template override old_package.test.pt, we display a warning that the package should use new_package.test.pt.
  • The override with the old name still works: instead of new_package/test.pt, the override is used.
  • Of course an override with the new name works as well.

Sample warning for a template that is moved from plone.app.layout to plone.classicui:

UserWarning: Template /Users/maurits/zeelandia/plone60/src/zeelandia.theme/src/zeelandia/theme/browser/overrides/plone.app.layout.viewlets.searchbox.pt deprecated, use plone.classicui.viewlets.searchbox.pt

For background, see plone/plone.classicui#7

This works for me when I try it out, but it would be better to have tests, so I made this a draft PR.

This can be used when you move templates and want an existing jbot
override for the old template path to still work.

Example:

* You move `old_package/test.pt` to `new_package/test.pt`.
* You register a dictionary with: `{"old_package.test.pt": "new_package.test.pt"}`
* If a third party package has a template override `old_package.test.pt`, we display a warning that the package should use `new_package.test.pt`.
* The override with the old name still works: instead of `new_package/test.pt`, the override is used.
* Of course an override with the new name works as well.

Sample warning for a template that is moved from plone.app.layout to plone.classicui:

UserWarning: Template /Users/maurits/zeelandia/plone60/src/zeelandia.theme/src/zeelandia/theme/browser/overrides/plone.app.layout.viewlets.searchbox.pt deprecated, use plone.classicui.viewlets.searchbox.pt

For background, see plone/plone.classicui#7
@mauritsvanrees mauritsvanrees force-pushed the maurits-deprecated-templates-directives branch from 9b10d7b to 06db058 Compare February 7, 2025 23:15
@coveralls
Copy link

coveralls commented Feb 10, 2025

Pull Request Test Coverage Report for Build 13259735283

Details

  • 42 of 42 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.5%) to 81.597%

Totals Coverage Status
Change from base Build 13258827457: 1.5%
Covered Lines: 395
Relevant Lines: 470

💛 - Coveralls

ale-rt and others added 3 commits February 10, 2025 16:42
…plates-directives/feature

Add a ``jbot-deprecations`` ZCML feature to conditionally set depreca…
And remove a comment on how to enable Chameleon: that is out of scope for z3c.jbot.  Anyone wanting to use this, will have configured this correctly years ago.
@mauritsvanrees
Copy link
Member Author

@ale-rt I have added documentation but I did not test it. Probably I made some mistakes. Leaving for dinner now. ;-)

@icemac icemac requested a review from malthe February 11, 2025 08:29
@ale-rt
Copy link
Member

ale-rt commented Feb 11, 2025

@ale-rt I have added documentation but I did not test it. Probably I made some mistakes. Leaving for dinner now. ;-)

Thanks!

@mauritsvanrees mauritsvanrees marked this pull request as ready for review February 11, 2025 09:42
@mauritsvanrees
Copy link
Member Author

Ready for review now.

@icemac icemac merged commit e37a412 into master Feb 12, 2025
11 checks passed
@icemac icemac deleted the maurits-deprecated-templates-directives branch February 12, 2025 08:40
@icemac
Copy link
Member

icemac commented Feb 12, 2025

I just released https://pypi.org/project/z3c.jbot/2.2/.

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.

4 participants