-
-
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: Products.CMFPlacefulWorkflow
Branch: refs/heads/master Date: 2020-08-22T10:46:06+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/Products.CMFPlacefulWorkflow@846adab Fix deprecation warning at startup for setDefaultRoles. ``` DeprecationWarning: setDefaultRoles is deprecated. Please use addPermission from AccessControl.Permission. ``` In CMFCore it is deprecated by zope.deferredimport. Files changed: A news/34.bugfix M Products/CMFPlacefulWorkflow/permissions.py Repository: Products.CMFPlacefulWorkflow Branch: refs/heads/master Date: 2020-08-24T11:20:08+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/Products.CMFPlacefulWorkflow@a4413ae Fix possible UnicodeDecodeError getting the long description. Files changed: M setup.py Repository: Products.CMFPlacefulWorkflow Branch: refs/heads/master Date: 2020-08-24T18:06:01+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/Products.CMFPlacefulWorkflow@eda6670 Put long_description in setup.cfg. I hope this fixes a UnicodeDecodeError on Python 3.6 on some machines, without needing special code in setup.py. Files changed: M setup.cfg M setup.py Repository: Products.CMFPlacefulWorkflow Branch: refs/heads/master Date: 2020-08-24T22:09:12+02:00 Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl> Commit: plone/Products.CMFPlacefulWorkflow@ed89ee5 Merge pull request #34 from plone/maurits/fix-startup-warnings Fix deprecation warning at startup for setDefaultRoles. Files changed: A news/34.bugfix M Products/CMFPlacefulWorkflow/permissions.py M setup.cfg M setup.py
- Loading branch information
1 parent
acf5900
commit 1995ad1
Showing
1 changed file
with
67 additions
and
10 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,19 +1,76 @@ | ||
Repository: icalendar | ||
Repository: Products.CMFPlacefulWorkflow | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2020-08-24T15:27:21+02:00 | ||
Author: Simon Budig (simon-budig) <simon@budig.de> | ||
Commit: https://github.com/collective/icalendar/commit/2a82c88c65dc513f6246dd0c2adf7d1a7fc19fac | ||
Date: 2020-08-22T10:46:06+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/Products.CMFPlacefulWorkflow/commit/846adab8964f877d1ad4a2b2bafd2084af278787 | ||
|
||
Correct the handling of rrules within timezone definitions. | ||
Fix deprecation warning at startup for setDefaultRoles. | ||
|
||
Fix for https://github.com/collective/icalendar/issues/303 | ||
``` | ||
DeprecationWarning: setDefaultRoles is deprecated. Please use addPermission from AccessControl.Permission. | ||
``` | ||
|
||
In CMFCore it is deprecated by zope.deferredimport. | ||
|
||
Files changed: | ||
A news/34.bugfix | ||
M Products/CMFPlacefulWorkflow/permissions.py | ||
|
||
b'diff --git a/Products/CMFPlacefulWorkflow/permissions.py b/Products/CMFPlacefulWorkflow/permissions.py\nindex df4c2aa..e078073 100644\n--- a/Products/CMFPlacefulWorkflow/permissions.py\n+++ b/Products/CMFPlacefulWorkflow/permissions.py\n@@ -2,7 +2,8 @@\n """ Zope 2 permissions\n """\n \n-from Products.CMFCore.permissions import setDefaultRoles\n+from AccessControl.Permission import addPermission\n+\n \n ManageWorkflowPolicies = \'CMFPlacefulWorkflow: Manage workflow policies\'\n-setDefaultRoles(ManageWorkflowPolicies, (\'Manager\', \'Site Administrator\'))\n+addPermission(ManageWorkflowPolicies, (\'Manager\', \'Site Administrator\'))\ndiff --git a/news/34.bugfix b/news/34.bugfix\nnew file mode 100644\nindex 0000000..2dc956c\n--- /dev/null\n+++ b/news/34.bugfix\n@@ -0,0 +1,2 @@\n+Fix deprecation warning at startup for setDefaultRoles.\n+[maurits]\n' | ||
|
||
Repository: Products.CMFPlacefulWorkflow | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2020-08-24T11:20:08+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/Products.CMFPlacefulWorkflow/commit/a4413ae9c0ab29249fbbd08d6f9e4725fe6392b4 | ||
|
||
Fix possible UnicodeDecodeError getting the long description. | ||
|
||
Files changed: | ||
M setup.py | ||
|
||
b'diff --git a/setup.py b/setup.py\nindex fe885f8..ff4874e 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -2,12 +2,34 @@\n \n version = \'2.0.3.dev0\'\n \n+\n+def read(filename):\n+ with open(filename) as myfile:\n+ try:\n+ return myfile.read()\n+ except UnicodeDecodeError:\n+ # Happens on one Jenkins node on Python 3.6,\n+ # so maybe it happens for users too.\n+ pass\n+ # Opening and reading as text failed, so retry opening as bytes.\n+ with open(filename, "rb") as myfile:\n+ contents = myfile.read()\n+ return contents.decode("utf-8")\n+\n+\n+long_description = "\\n".join(\n+ [\n+ read("README.rst"),\n+ read("CHANGES.rst"),\n+ ]\n+)\n+\n+\n setup(\n name=\'Products.CMFPlacefulWorkflow\',\n version=version,\n description="Workflow policies for Plone",\n- long_description=(open("README.rst").read() + "\\n" +\n- open("CHANGES.rst").read()),\n+ long_description=long_description,\n classifiers=[\n "Development Status :: 5 - Production/Stable",\n "Framework :: Plone",\n' | ||
|
||
Repository: Products.CMFPlacefulWorkflow | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2020-08-24T18:06:01+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/Products.CMFPlacefulWorkflow/commit/eda6670f50436d2dea426a389563df1223760978 | ||
|
||
Put long_description in setup.cfg. | ||
|
||
I hope this fixes a UnicodeDecodeError on Python 3.6 on some machines, | ||
without needing special code in setup.py. | ||
|
||
Files changed: | ||
M setup.cfg | ||
M setup.py | ||
|
||
b'diff --git a/setup.cfg b/setup.cfg\nindex 06aa277..a6c51c7 100644\n--- a/setup.cfg\n+++ b/setup.cfg\n@@ -1,3 +1,6 @@\n+[metadata]\n+long_description = file: README.rst, CHANGES.rst\n+\n [zest.releaser]\n create-wheel = yes\n \ndiff --git a/setup.py b/setup.py\nindex ff4874e..2da3f1b 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -3,33 +3,12 @@\n version = \'2.0.3.dev0\'\n \n \n-def read(filename):\n- with open(filename) as myfile:\n- try:\n- return myfile.read()\n- except UnicodeDecodeError:\n- # Happens on one Jenkins node on Python 3.6,\n- # so maybe it happens for users too.\n- pass\n- # Opening and reading as text failed, so retry opening as bytes.\n- with open(filename, "rb") as myfile:\n- contents = myfile.read()\n- return contents.decode("utf-8")\n-\n-\n-long_description = "\\n".join(\n- [\n- read("README.rst"),\n- read("CHANGES.rst"),\n- ]\n-)\n-\n-\n setup(\n name=\'Products.CMFPlacefulWorkflow\',\n version=version,\n description="Workflow policies for Plone",\n- long_description=long_description,\n+ # Note: long_description is in setup.cfg\n+ # to avoid needing workarounds for UnicodeDecodeErrors.\n classifiers=[\n "Development Status :: 5 - Production/Stable",\n "Framework :: Plone",\n' | ||
|
||
Repository: Products.CMFPlacefulWorkflow | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2020-08-24T22:09:12+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl> | ||
Commit: https://github.com/plone/Products.CMFPlacefulWorkflow/commit/ed89ee5d710ac87c0ea997e47295d1ed6b175e96 | ||
|
||
Merge pull request #34 from plone/maurits/fix-startup-warnings | ||
|
||
Fix deprecation warning at startup for setDefaultRoles. | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M src/icalendar/cal.py | ||
M src/icalendar/tests/test_timezoned.py | ||
A news/34.bugfix | ||
M Products/CMFPlacefulWorkflow/permissions.py | ||
M setup.cfg | ||
M setup.py | ||
|
||
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex f7063db..9911ab2 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -14,7 +14,7 @@ New features:\n \n Bug fixes:\n \n-- *add item here*\n+- fixed rrule handling, re-enabled test_create_america_new_york()\n \n \n 4.0.6 (2020-05-06)\ndiff --git a/src/icalendar/cal.py b/src/icalendar/cal.py\nindex 36620a1..2c7dcd7 100644\n--- a/src/icalendar/cal.py\n+++ b/src/icalendar/cal.py\n@@ -17,7 +17,7 @@\n from icalendar.timezone_cache import _timezone_cache\n \n import pytz\n-import dateutil.rrule\n+import dateutil.rrule, dateutil.tz\n from pytz.tzinfo import DstTzInfo\n \n from icalendar.compat import unicode_type\n@@ -536,15 +536,23 @@ def _extract_offsets(component, tzname):\n \n # expand recurrences\n if \'RRULE\' in component:\n+ # to be paranoid about correct weekdays\n+ # evaluate the rrule with the current offset\n+ tzi = dateutil.tz.tzoffset ("(offsetfrom)", offsetfrom)\n+ rrstart = dtstart.replace (tzinfo=tzi)\n+\n rrulestr = component[\'RRULE\'].to_ical().decode(\'utf-8\')\n- rrule = dateutil.rrule.rrulestr(rrulestr, dtstart=dtstart)\n+ rrule = dateutil.rrule.rrulestr(rrulestr, dtstart=rrstart)\n if not {\'UNTIL\', \'COUNT\'}.intersection(component[\'RRULE\'].keys()):\n # pytz.timezones don\'t know any transition dates after 2038\n # either\n- rrule._until = datetime(2038, 12, 31)\n- elif \'UNTIL\' in component[\'RRULE\'] and rrule._until.tzinfo:\n- rrule._until = rrule._until.replace(tzinfo=None)\n- transtimes = rrule\n+ rrule._until = datetime(2038, 12, 31, tzinfo=pytz.UTC)\n+\n+ # constructing the pytz-timezone requires UTC transition times.\n+ # here we construct local times without tzinfo, the offset to UTC\n+ # gets subtracted in to_tz().\n+ transtimes = [dt.replace (tzinfo=None) for dt in rrule]\n+\n # or rdates\n elif \'RDATE\' in component:\n if not isinstance(component[\'RDATE\'], list):\ndiff --git a/src/icalendar/tests/test_timezoned.py b/src/icalendar/tests/test_timezoned.py\nindex 6dd1bb8..c80abd4 100644\n--- a/src/icalendar/tests/test_timezoned.py\n+++ b/src/icalendar/tests/test_timezoned.py\n@@ -149,14 +149,9 @@ def test_tzinfo_dateutil(self):\n \n class TestTimezoneCreation(unittest.TestCase):\n \n- @unittest.expectedFailure\n def test_create_america_new_york(self):\n """testing America/New_York, the most complex example from the\n RFC"""\n- # FIXME\n- # This currently fails because of mixed naive and timezone\n- # aware datetimes in dtstart and until which breaks\n- # dateutil recurrence.\n \n directory = os.path.dirname(__file__)\n with open(os.path.join(directory, \'america_new_york.ics\'), \'rb\') as fp:\n' | ||
b'diff --git a/Products/CMFPlacefulWorkflow/permissions.py b/Products/CMFPlacefulWorkflow/permissions.py\nindex df4c2aa..e078073 100644\n--- a/Products/CMFPlacefulWorkflow/permissions.py\n+++ b/Products/CMFPlacefulWorkflow/permissions.py\n@@ -2,7 +2,8 @@\n """ Zope 2 permissions\n """\n \n-from Products.CMFCore.permissions import setDefaultRoles\n+from AccessControl.Permission import addPermission\n+\n \n ManageWorkflowPolicies = \'CMFPlacefulWorkflow: Manage workflow policies\'\n-setDefaultRoles(ManageWorkflowPolicies, (\'Manager\', \'Site Administrator\'))\n+addPermission(ManageWorkflowPolicies, (\'Manager\', \'Site Administrator\'))\ndiff --git a/news/34.bugfix b/news/34.bugfix\nnew file mode 100644\nindex 0000000..2dc956c\n--- /dev/null\n+++ b/news/34.bugfix\n@@ -0,0 +1,2 @@\n+Fix deprecation warning at startup for setDefaultRoles.\n+[maurits]\ndiff --git a/setup.cfg b/setup.cfg\nindex 06aa277..a6c51c7 100644\n--- a/setup.cfg\n+++ b/setup.cfg\n@@ -1,3 +1,6 @@\n+[metadata]\n+long_description = file: README.rst, CHANGES.rst\n+\n [zest.releaser]\n create-wheel = yes\n \ndiff --git a/setup.py b/setup.py\nindex fe885f8..2da3f1b 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -2,12 +2,13 @@\n \n version = \'2.0.3.dev0\'\n \n+\n setup(\n name=\'Products.CMFPlacefulWorkflow\',\n version=version,\n description="Workflow policies for Plone",\n- long_description=(open("README.rst").read() + "\\n" +\n- open("CHANGES.rst").read()),\n+ # Note: long_description is in setup.cfg\n+ # to avoid needing workarounds for UnicodeDecodeErrors.\n classifiers=[\n "Development Status :: 5 - Production/Stable",\n "Framework :: Plone",\n' | ||
|