-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fc] Repository: plone.recipe.zope2instance
Branch: refs/heads/master Date: 2019-02-06T14:24:55+01:00 Author: tschorr (tschorr) <t_schorr@gmx.de> Commit: plone/plone.recipe.zope2instance@cef2959 display warnings in fg mode Files changed: M CHANGES.rst M src/plone/recipe/zope2instance/ctl.py Repository: plone.recipe.zope2instance Branch: refs/heads/master Date: 2019-02-06T16:05:58+01:00 Author: Philip Bauer (pbauer) <bauer@starzel.de> Commit: plone/plone.recipe.zope2instance@58ea375 Merge pull request #70 from plone/fg_display_deprecation_warnings Display warnings in fg mode Files changed: M CHANGES.rst M src/plone/recipe/zope2instance/ctl.py
- Loading branch information
Showing
1 changed file
with
16 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,34 @@ | ||
Repository: plone.app.upgrade | ||
Repository: plone.recipe.zope2instance | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2019-02-06T12:34:33+01:00 | ||
Author: Wolfgang Thomas (pysailor) <thomas@syslab.com> | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/36268d81c49ec5ebac362bd7c03647ee3fc133ce | ||
Date: 2019-02-06T14:24:55+01:00 | ||
Author: tschorr (tschorr) <t_schorr@gmx.de> | ||
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/cef29594bb8cc74eac5b2c73ecf6064ae58084ab | ||
|
||
Rebuild the _members data structure in portal_memberdata. Fixes #190 | ||
display warnings in fg mode | ||
|
||
Files changed: | ||
A news/190.bugfix | ||
M plone/app/upgrade/v52/alphas.py | ||
M CHANGES.rst | ||
M src/plone/recipe/zope2instance/ctl.py | ||
|
||
b"diff --git a/news/190.bugfix b/news/190.bugfix\nnew file mode 100644\nindex 00000000..e850d00f\n--- /dev/null\n+++ b/news/190.bugfix\n@@ -0,0 +1 @@\n+Provide upgrade step that purges and rebuild the _members data structure in portal_memberdata [pysailor]\ndiff --git a/plone/app/upgrade/v52/alphas.py b/plone/app/upgrade/v52/alphas.py\nindex 9d530ae5..dd660f8e 100644\n--- a/plone/app/upgrade/v52/alphas.py\n+++ b/plone/app/upgrade/v52/alphas.py\n@@ -1,9 +1,11 @@\n # -*- coding: utf-8 -*-\n+from BTrees.OOBTree import OOBTree\n from plone.app.upgrade.utils import cleanUpSkinsTool\n from plone.app.upgrade.utils import loadMigrationProfile\n from plone.folder.nogopip import manage_addGopipIndex\n from plone.registry.interfaces import IRegistry\n from Products.CMFCore.utils import getToolByName\n+from Products.PlonePAS.tools.memberdata import MemberData\n from zope.component import getUtility\n \n import logging\n@@ -29,6 +31,29 @@ def migrate_gopipindex(context):\n manage_addGopipIndex(catalog, 'getObjPositionInParent')\n \n \n+def rebuild_memberdata(context):\n+ # MemberData has changed radically, see plone/Products.PlonePAS#24\n+ # This results in a bug in upgraded sites: plone/Products.CMFPlone#2722\n+ # We purge the _members storage of portal_memberdata and rebuild it\n+ # with new MemberData records that we get by creating them via a lookup of\n+ # all members in portal_membership.\n+ logger.info(\n+ 'Rebuilding member data information. This step can take a while if '\n+ 'your site has many users.')\n+ md_tool = getToolByName(context, 'portal_memberdata')\n+ ms_tool = getToolByName(context, 'portal_membership')\n+ # We cannot access data in _members any more, therefore purge it\n+ md_tool._members = OOBTree()\n+ # Iterate over all existing members and add their data to the tool again\n+ for member in ms_tool.searchForMembers():\n+ try:\n+ md = MemberData(member, md_tool)\n+ # If we can't create a MemberData record for this member, skip it\n+ except:\n+ continue\n+ md_tool.registerMemberData(md._md, md.getId())\n+\n+\n def to52alpha1(context):\n loadMigrationProfile(context, 'profile-plone.app.upgrade.v52:to52alpha1')\n portal = getToolByName(context, 'portal_url').getPortalObject()\n@@ -36,3 +61,4 @@ def to52alpha1(context):\n \n cleanup_resources()\n migrate_gopipindex(context)\n+ rebuild_memberdata(context)\n" | ||
b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex e41d866..ce6b9bd 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -6,6 +6,8 @@ Changelog\n \n - Use correct debug switch for WSGI.\n (`Products.CMFPlone #2719 <https://github.com/plone/Products.CMFPlone/issues/2719>`_)\n+ Display warnings in debug mode with WSGI (override with PYTHONWARNINGS).\n+ (`Products.CMFPlone #2724 <https://github.com/plone/Products.CMFPlone/issues/2724>`_)\n [tschorr]\n \n - Improve debugging of run scripts by providing the source code for the\ndiff --git a/src/plone/recipe/zope2instance/ctl.py b/src/plone/recipe/zope2instance/ctl.py\nindex e4ab506..0aee689 100644\n--- a/src/plone/recipe/zope2instance/ctl.py\n+++ b/src/plone/recipe/zope2instance/ctl.py\n@@ -810,7 +810,12 @@ def do_foreground(self, arg, debug=True):\n local_additions = []\n \n if debug:\n- debug_switch = '-d' if self.options.wsgi else '-X'\n+ if self.options.wsgi:\n+ debug_switch = '-d'\n+ if 'PYTHONWARNINGS' not in env:\n+ env['PYTHONWARNINGS'] = 'on'\n+ else:\n+ debug_switch = '-X'\n if not program.count(debug_switch):\n local_additions += [debug_switch]\n if not program.count('debug-mode=on'):\n" | ||
|
||
Repository: plone.app.upgrade | ||
Repository: plone.recipe.zope2instance | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2019-02-06T15:21:47+01:00 | ||
Date: 2019-02-06T16:05:58+01:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/6e56cb34ce709dc134ffe218d1402e8106026675 | ||
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/58ea3753ad632f891d388f26e743e8bc92910a9e | ||
|
||
Merge branch 'master' into pysailor-rebuild-memberdata | ||
Merge pull request #70 from plone/fg_display_deprecation_warnings | ||
|
||
Files changed: | ||
A news/192.bugfix | ||
M plone/app/upgrade/v52/alphas.py | ||
M setup.cfg | ||
M setup.py | ||
|
||
b'diff --git a/news/192.bugfix b/news/192.bugfix\nnew file mode 100644\nindex 00000000..5777bde9\n--- /dev/null\n+++ b/news/192.bugfix\n@@ -0,0 +1 @@\n+Update all FTIs that use the RichText or LeadImage behaviors\ndiff --git a/plone/app/upgrade/v52/alphas.py b/plone/app/upgrade/v52/alphas.py\nindex dd660f8e..3b3938a0 100644\n--- a/plone/app/upgrade/v52/alphas.py\n+++ b/plone/app/upgrade/v52/alphas.py\n@@ -2,6 +2,7 @@\n from BTrees.OOBTree import OOBTree\n from plone.app.upgrade.utils import cleanUpSkinsTool\n from plone.app.upgrade.utils import loadMigrationProfile\n+from plone.dexterity.interfaces import IDexterityFTI\n from plone.folder.nogopip import manage_addGopipIndex\n from plone.registry.interfaces import IRegistry\n from Products.CMFCore.utils import getToolByName\n@@ -54,6 +55,34 @@ def rebuild_memberdata(context):\n md_tool.registerMemberData(md._md, md.getId())\n \n \n+def fix_core_behaviors_in_ftis(context):\n+ # The behaviors for IRichText and ILeadImage have been renamed.\n+ # All FTIs that use them must be updated accordingly\n+ # See plone/plone.app.contenttypes#480\n+ types_tool = getToolByName(context, \'portal_types\')\n+ to_replace = {\n+ \'plone.app.contenttypes.behaviors.richtext.IRichText\':\n+ \'plone.app.contenttypes.behaviors.richtext.IRichTextBehavior\',\n+ \'plone.app.contenttypes.behaviors.leadimage.ILeadImage\':\n+ \'plone.app.contenttypes.behaviors.leadimage.ILeadImageBehavior\',\n+ }\n+ ftis = types_tool.listTypeInfo()\n+ for fti in ftis:\n+ # Since we\'re handling dexterity behaviors, we only care about\n+ # dexterity FTIs\n+ if not IDexterityFTI.providedBy(fti):\n+ continue\n+ behaviors = []\n+ change_needed = False\n+ for behavior in fti.behaviors:\n+ if behavior in to_replace:\n+ behavior = to_replace[behavior]\n+ change_needed = True\n+ behaviors.append(behavior)\n+ if change_needed:\n+ fti.behaviors = tuple(behaviors)\n+\n+\n def to52alpha1(context):\n loadMigrationProfile(context, \'profile-plone.app.upgrade.v52:to52alpha1\')\n portal = getToolByName(context, \'portal_url\').getPortalObject()\n@@ -62,3 +91,4 @@ def to52alpha1(context):\n cleanup_resources()\n migrate_gopipindex(context)\n rebuild_memberdata(context)\n+ fix_core_behaviors_in_ftis(context)\ndiff --git a/setup.cfg b/setup.cfg\nindex 199a05bb..c1ffe140 100644\n--- a/setup.cfg\n+++ b/setup.cfg\n@@ -1,11 +1,7 @@\n-[zest.releaser]\n-create-wheel = yes\n-\n-# When Python 2-3 compatible:\n-# [bdist_wheel]\n-# universal = 1\n-\n [check-manifest]\n ignore =\n *.cfg\n bootstrap.py\n+\n+[bdist_wheel]\n+universal = 1\ndiff --git a/setup.py b/setup.py\nindex 0c2f1df9..28dd9cc0 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -17,6 +17,7 @@\n "Framework :: Plone :: 5.1",\n "Framework :: Plone :: 5.2",\n "Framework :: Zope2",\n+ "Framework :: Zope :: 4",\n "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",\n "Operating System :: OS Independent",\n "Programming Language :: Python",\n' | ||
|
||
Repository: plone.app.upgrade | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2019-02-06T15:22:11+01:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/cd4298bffd6bbd049339fad794fe239aa1dd7dd4 | ||
|
||
Merge pull request #191 from plone/pysailor-rebuild-memberdata | ||
|
||
Fix member data stored in MemberDataTool | ||
Display warnings in fg mode | ||
|
||
Files changed: | ||
A news/190.bugfix | ||
M plone/app/upgrade/v52/alphas.py | ||
M CHANGES.rst | ||
M src/plone/recipe/zope2instance/ctl.py | ||
|
||
b"diff --git a/news/190.bugfix b/news/190.bugfix\nnew file mode 100644\nindex 00000000..e850d00f\n--- /dev/null\n+++ b/news/190.bugfix\n@@ -0,0 +1 @@\n+Provide upgrade step that purges and rebuild the _members data structure in portal_memberdata [pysailor]\ndiff --git a/plone/app/upgrade/v52/alphas.py b/plone/app/upgrade/v52/alphas.py\nindex 50112b46..3b3938a0 100644\n--- a/plone/app/upgrade/v52/alphas.py\n+++ b/plone/app/upgrade/v52/alphas.py\n@@ -1,10 +1,12 @@\n # -*- coding: utf-8 -*-\n+from BTrees.OOBTree import OOBTree\n from plone.app.upgrade.utils import cleanUpSkinsTool\n from plone.app.upgrade.utils import loadMigrationProfile\n from plone.dexterity.interfaces import IDexterityFTI\n from plone.folder.nogopip import manage_addGopipIndex\n from plone.registry.interfaces import IRegistry\n from Products.CMFCore.utils import getToolByName\n+from Products.PlonePAS.tools.memberdata import MemberData\n from zope.component import getUtility\n \n import logging\n@@ -30,6 +32,29 @@ def migrate_gopipindex(context):\n manage_addGopipIndex(catalog, 'getObjPositionInParent')\n \n \n+def rebuild_memberdata(context):\n+ # MemberData has changed radically, see plone/Products.PlonePAS#24\n+ # This results in a bug in upgraded sites: plone/Products.CMFPlone#2722\n+ # We purge the _members storage of portal_memberdata and rebuild it\n+ # with new MemberData records that we get by creating them via a lookup of\n+ # all members in portal_membership.\n+ logger.info(\n+ 'Rebuilding member data information. This step can take a while if '\n+ 'your site has many users.')\n+ md_tool = getToolByName(context, 'portal_memberdata')\n+ ms_tool = getToolByName(context, 'portal_membership')\n+ # We cannot access data in _members any more, therefore purge it\n+ md_tool._members = OOBTree()\n+ # Iterate over all existing members and add their data to the tool again\n+ for member in ms_tool.searchForMembers():\n+ try:\n+ md = MemberData(member, md_tool)\n+ # If we can't create a MemberData record for this member, skip it\n+ except:\n+ continue\n+ md_tool.registerMemberData(md._md, md.getId())\n+\n+\n def fix_core_behaviors_in_ftis(context):\n # The behaviors for IRichText and ILeadImage have been renamed.\n # All FTIs that use them must be updated accordingly\n@@ -65,4 +90,5 @@ def to52alpha1(context):\n \n cleanup_resources()\n migrate_gopipindex(context)\n+ rebuild_memberdata(context)\n fix_core_behaviors_in_ftis(context)\n" | ||
b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex e41d866..ce6b9bd 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -6,6 +6,8 @@ Changelog\n \n - Use correct debug switch for WSGI.\n (`Products.CMFPlone #2719 <https://github.com/plone/Products.CMFPlone/issues/2719>`_)\n+ Display warnings in debug mode with WSGI (override with PYTHONWARNINGS).\n+ (`Products.CMFPlone #2724 <https://github.com/plone/Products.CMFPlone/issues/2724>`_)\n [tschorr]\n \n - Improve debugging of run scripts by providing the source code for the\ndiff --git a/src/plone/recipe/zope2instance/ctl.py b/src/plone/recipe/zope2instance/ctl.py\nindex e4ab506..0aee689 100644\n--- a/src/plone/recipe/zope2instance/ctl.py\n+++ b/src/plone/recipe/zope2instance/ctl.py\n@@ -810,7 +810,12 @@ def do_foreground(self, arg, debug=True):\n local_additions = []\n \n if debug:\n- debug_switch = '-d' if self.options.wsgi else '-X'\n+ if self.options.wsgi:\n+ debug_switch = '-d'\n+ if 'PYTHONWARNINGS' not in env:\n+ env['PYTHONWARNINGS'] = 'on'\n+ else:\n+ debug_switch = '-X'\n if not program.count(debug_switch):\n local_additions += [debug_switch]\n if not program.count('debug-mode=on'):\n" | ||
|