Created
July 9, 2025 10:44
-
-
Save thet/ada9947b9e25bc5ce6167a1fb0a3b552 to your computer and use it in GitHub Desktop.
Plone Migrator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start of a Plone code migration script. | |
# Should be refactored to use AST based code manipulation, just like pyupgrade does. | |
function replace() { | |
find . -name "$1" -type f -exec sed -i "s/$2/$3/g" {} \; | |
} | |
replace "*.py" "^from Products.CMFPlone.browser.navtree import getNavigationRoot$" "from plone.base.navigationroot import get_navigation_root" | |
replace "*.py" "^from plone.app.layout.navigation.root import getNavigationRoot$" "from plone.base.navigationroot import get_navigation_root" | |
replace "*.py" "getNavigationRoot(" "get_navigation_root(" | |
git commit -am"Fix Plone 6 imports - get_navigation_root" | |
replace "*.py" "^from plone.app.layout.navigation.root import getNavigationRootObject$" "from plone.base.navigationroot import get_navigation_root_object" | |
replace "*.py" "getNavigationRootObject(" "get_navigation_root_object(" | |
git commit -am"Fix Plone 6 imports - get_navigation_root_object" | |
replace "*.zcml" "plone.app.layout.navigation.interfaces.INavigationRoot\"" "plone.base.interfaces.siteroot.INavigationRoot" | |
git commit -am"Fix Plone 6 imports - INavigationRoot" | |
replace "*.py" "^from Products.CMFPlone.utils import safe_unicode$" "from plone.base.utils import safe_text" | |
replace "*.py" "safe_unicode(" "safe_text(" | |
git commit -am"Fix Plone 6 imports - safe_text" | |
# Ref: https://github.com/plone/Products.CMFPlone/pull/3960 | |
replace "*.py" "\.getFolderContents()" '\.restrictedTraverse("@@contentlisting")()' | |
git commit -am"Fix Plone 6 imports - @@contentlisting" | |
# Ref: https://github.com/plone/Products.CMFPlone/pull/3960 | |
grep -R queryCatalog | |
# DeprecationWarning: Use method view_template_id from @@plone_context_state instead. Will be removed in Plone 7 | |
grep -R getViewTemplateId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment