From 7d62963abd9c7ca9cef2214e236dc5a452c40c8f Mon Sep 17 00:00:00 2001 From: jensens Date: Tue, 23 Oct 2018 11:25:30 +0200 Subject: [PATCH] [fc] Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-03T16:23:32+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/1d9cf0017ab01c2e19eb085301b80861a1139f23 compatibility with zope2 and zope4 Files changed: M src/plone/app/debugtoolbar/browser/global.pt M src/plone/app/debugtoolbar/browser/global.py Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-03T16:46:51+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/da0c8305157ca6ac97a325370cf8b4cedd93ff30 run sixer Files changed: M src/plone/app/debugtoolbar/browser/context.py M src/plone/app/debugtoolbar/browser/interactive.py Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-03T17:10:34+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/0c648b1e8c2bb0da94df14d61462b9c0600acceb run modernizer Files changed: M bootstrap.py M src/plone/app/debugtoolbar/browser/context.py Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-04T14:31:18+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/670e942680933d0123662ea81799947c2140572e update for python3 Files changed: M src/plone/app/debugtoolbar/browser/global.py M src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-05T10:59:05+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/288aef4fa9916be1e5359b5380dfb120b1c087c5 do not show server listing if servers not available Files changed: M src/plone/app/debugtoolbar/browser/global.pt Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-05T11:21:10+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/b3b411ba5f390eddac442b01e5ce0ff87feaa5fd comment on database lock error Files changed: M src/plone/app/debugtoolbar/browser/global.py Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-05T12:34:35+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/49e79a3c7d40bff9229339cad9518d3dcf2a1989 unhide debugtoolbar viewlets on reinstall Files changed: M src/plone/app/debugtoolbar/profiles/default/viewlets.xml Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-05T12:42:34+02:00 Author: Jan Mevissen (jmevissen) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/dd2e59ff92f3e87a0fc4befa58050c17ac39313b Prepare for Python 2 / 3 compatibility Files changed: M CHANGES.rst M setup.py Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-05T15:25:03+02:00 Author: ale-rt (ale-rt) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/c7ad4741f0d4f71e5679740f6bc1126c15c98607 Fix test setup Files changed: M src/plone/app/debugtoolbar/testing.py M src/plone/app/debugtoolbar/tests/test_setup.py D src/plone/app/debugtoolbar/tests/test_example.py Repository: plone.app.debugtoolbar Branch: refs/heads/master Date: 2018-10-23T11:25:30+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.debugtoolbar/commit/264dbefded53d530c3664027148a40b1a41b7a5d Merge pull request #20 from plone/python3 Python3 Files changed: M CHANGES.rst M bootstrap.py M setup.py M src/plone/app/debugtoolbar/browser/context.py M src/plone/app/debugtoolbar/browser/global.pt M src/plone/app/debugtoolbar/browser/global.py M src/plone/app/debugtoolbar/browser/interactive.py M src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js M src/plone/app/debugtoolbar/profiles/default/viewlets.xml M src/plone/app/debugtoolbar/testing.py M src/plone/app/debugtoolbar/tests/test_setup.py D src/plone/app/debugtoolbar/tests/test_example.py --- last_commit.txt | 156 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 116 insertions(+), 40 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index e3b6c8ef3a..2e399eef0c 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,94 +1,170 @@ -Repository: plone.reload +Repository: plone.app.debugtoolbar Branch: refs/heads/master -Date: 2018-10-04T13:55:10+02:00 +Date: 2018-10-03T16:23:32+02:00 Author: Jan Mevissen (jmevissen) -Commit: https://github.com/plone/plone.reload/commit/66c5273a2fbe3358e0492e0fe8146cfda7952756 +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/1d9cf0017ab01c2e19eb085301b80861a1139f23 -update testing for python3 +compatibility with zope2 and zope4 Files changed: -M plone/reload/tests/test_reload.py +M src/plone/app/debugtoolbar/browser/global.pt +M src/plone/app/debugtoolbar/browser/global.py -b"diff --git a/plone/reload/tests/test_reload.py b/plone/reload/tests/test_reload.py\nindex 1707c82..06951ca 100644\n--- a/plone/reload/tests/test_reload.py\n+++ b/plone/reload/tests/test_reload.py\n@@ -1,6 +1,8 @@\n import os\n+import shutil\n import tempfile\n import unittest\n+import importlib\n \n from plone.reload import xreload\n \n@@ -21,6 +23,7 @@ def _create_temp(self):\n fd.close()\n name = os.path.split(temp.name)[-1]\n modulename = 'plone.reload.tests.data.' + name[:-3]\n+ importlib.invalidate_caches()\n module = __import__(modulename,\n fromlist=['plone', 'reload', 'tests', 'data'])\n return temp.name, module\n@@ -47,6 +50,10 @@ def tearDown(self):\n if os.path.isfile(data_init + 'c'):\n os.unlink(data_init + 'c')\n \n+ data_pycache = os.path.join(TESTS, '__pycache__')\n+ if os.path.isdir(data_pycache):\n+ shutil.rmtree(data_pycache)\n+\n \n class TestReloadModule(TestReload):\n \n" +b'diff --git a/src/plone/app/debugtoolbar/browser/global.pt b/src/plone/app/debugtoolbar/browser/global.pt\nindex 55578b5..c32ba4d 100644\n--- a/src/plone/app/debugtoolbar/browser/global.pt\n+++ b/src/plone/app/debugtoolbar/browser/global.pt\n@@ -52,7 +52,7 @@\n Process\n \n \n- \n+ \n Running for\n \n \ndiff --git a/src/plone/app/debugtoolbar/browser/global.py b/src/plone/app/debugtoolbar/browser/global.py\nindex 25cd452..e035e7b 100644\n--- a/src/plone/app/debugtoolbar/browser/global.py\n+++ b/src/plone/app/debugtoolbar/browser/global.py\n@@ -22,7 +22,11 @@ def update(self):\n \n self.servers = config.servers\n \n- self.appInfo = self.context.getPhysicalRoot()[\'Control_Panel\']\n+ try:\n+ self.appInfo = self.context.getPhysicalRoot()[\'Control_Panel\']\n+ except KeyError:\n+ # bbb import for Zope2\n+ self.appInfo = self.context.getPhysicalRoot().Control_Panel\n \n self.databases = []\n paths = dict([(x[1], x[0],) for x in config.dbtab.mount_paths.items()])\n' -Repository: plone.reload +Repository: plone.app.debugtoolbar Branch: refs/heads/master -Date: 2018-10-04T13:56:19+02:00 +Date: 2018-10-03T16:46:51+02:00 Author: Jan Mevissen (jmevissen) -Commit: https://github.com/plone/plone.reload/commit/72f3de4fd790f854a3adb6cbe1e2ace4a57d3a8d +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/da0c8305157ca6ac97a325370cf8b4cedd93ff30 -add zope.component.hooks to cleanups skips +run sixer Files changed: -M plone/reload/zcml.py +M src/plone/app/debugtoolbar/browser/context.py +M src/plone/app/debugtoolbar/browser/interactive.py -b"diff --git a/plone/reload/zcml.py b/plone/reload/zcml.py\nindex afc1321..74e5438 100644\n--- a/plone/reload/zcml.py\n+++ b/plone/reload/zcml.py\n@@ -17,6 +17,7 @@\n 'Products.Five.fiveconfigure',\n 'Products.Five.sizeconfigure',\n 'zope.component.globalregistry',\n+ 'zope.component.hooks', \n 'zope.schema.vocabulary',\n 'zope.security.management',\n 'zope.security.checker',\n" +b'diff --git a/src/plone/app/debugtoolbar/browser/context.py b/src/plone/app/debugtoolbar/browser/context.py\nindex 3a8e6ee..3e3d47e 100644\n--- a/src/plone/app/debugtoolbar/browser/context.py\n+++ b/src/plone/app/debugtoolbar/browser/context.py\n@@ -1,6 +1,7 @@\n # -*- coding: utf-8 -*-\n import types\n import inspect\n+import six\n \n from zope.interface import Interface\n from zope.interface import providedBy, directlyProvidedBy\n@@ -44,7 +45,7 @@ def update(self):\n generator = getAdapters((self.context, self.request,), Interface)\n while True:\n try:\n- name, view = generator.next()\n+ name, view = next(generator)\n \n if not IView.providedBy(view):\n continue\n@@ -94,7 +95,7 @@ def update(self):\n continue\n \n # FIXME: Should we include ComputedAttribute here ? [glenfant]\n- if isinstance(attr, (int, long, float, basestring, bool, list, tuple, dict, set, frozenset)):\n+ if isinstance(attr, (int, long, float, six.string_types, bool, list, tuple, dict, set, frozenset)):\n self.variables.append({\n \'name\': name,\n \'primitive\': True,\ndiff --git a/src/plone/app/debugtoolbar/browser/interactive.py b/src/plone/app/debugtoolbar/browser/interactive.py\nindex 6e2a698..05d7605 100644\n--- a/src/plone/app/debugtoolbar/browser/interactive.py\n+++ b/src/plone/app/debugtoolbar/browser/interactive.py\n@@ -3,6 +3,7 @@\n import cgi\n import threading\n import traceback\n+import six\n \n from zope.component import queryMultiAdapter\n from zope.publisher.browser import BrowserView\n@@ -133,7 +134,7 @@ def __call__(self):\n except:\n output = "%s" % traceback.format_exc()\n \n- if isinstance(output, unicode):\n+ if isinstance(output, six.text_type):\n output = output.encode(\'ascii\', \'xmlcharrefreplace\')\n elif not isinstance(output, str):\n output = repr(output)\n' -Repository: plone.reload +Repository: plone.app.debugtoolbar Branch: refs/heads/master -Date: 2018-10-05T14:51:45+02:00 -Author: ale-rt (ale-rt) -Commit: https://github.com/plone/plone.reload/commit/51f966697bde303bec60667ccbe714b738fd3f5c +Date: 2018-10-03T17:10:34+02:00 +Author: Jan Mevissen (jmevissen) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/0c648b1e8c2bb0da94df14d61462b9c0600acceb -Avoid an AttributeError when running on Python 2.7 +run modernizer Files changed: -M plone/reload/tests/test_reload.py +M bootstrap.py +M src/plone/app/debugtoolbar/browser/context.py -b"diff --git a/plone/reload/tests/test_reload.py b/plone/reload/tests/test_reload.py\nindex 06951ca..fbc51f4 100644\n--- a/plone/reload/tests/test_reload.py\n+++ b/plone/reload/tests/test_reload.py\n@@ -23,7 +23,11 @@ def _create_temp(self):\n fd.close()\n name = os.path.split(temp.name)[-1]\n modulename = 'plone.reload.tests.data.' + name[:-3]\n- importlib.invalidate_caches()\n+ try:\n+ importlib.invalidate_caches()\n+ except AttributeError:\n+ # invalidate_caches was introduced in Python 3.3\n+ pass\n module = __import__(modulename,\n fromlist=['plone', 'reload', 'tests', 'data'])\n return temp.name, module\n" +b'diff --git a/bootstrap.py b/bootstrap.py\nindex a459921..7324ba4 100644\n--- a/bootstrap.py\n+++ b/bootstrap.py\n@@ -18,6 +18,7 @@\n use the -c option to specify an alternate configuration file.\n """\n \n+from __future__ import print_function\n import os\n import shutil\n import sys\n@@ -73,7 +74,7 @@\n \n options, args = parser.parse_args()\n if options.version:\n- print("bootstrap.py version %s" % __version__)\n+ print(("bootstrap.py version %s" % __version__))\n sys.exit(0)\n \n \n@@ -83,7 +84,7 @@\n try:\n from urllib.request import urlopen\n except ImportError:\n- from urllib2 import urlopen\n+ from six.moves.urllib.request import urlopen\n \n ez = {}\n if os.path.exists(\'ez_setup.py\'):\ndiff --git a/src/plone/app/debugtoolbar/browser/context.py b/src/plone/app/debugtoolbar/browser/context.py\nindex 3e3d47e..977d14d 100644\n--- a/src/plone/app/debugtoolbar/browser/context.py\n+++ b/src/plone/app/debugtoolbar/browser/context.py\n@@ -95,7 +95,7 @@ def update(self):\n continue\n \n # FIXME: Should we include ComputedAttribute here ? [glenfant]\n- if isinstance(attr, (int, long, float, six.string_types, bool, list, tuple, dict, set, frozenset)):\n+ if isinstance(attr, (int, float, six.string_types, bool, list, tuple, dict, set, frozenset)):\n self.variables.append({\n \'name\': name,\n \'primitive\': True,\n' -Repository: plone.reload +Repository: plone.app.debugtoolbar Branch: refs/heads/master -Date: 2018-10-05T14:52:46+02:00 -Author: ale-rt (ale-rt) -Commit: https://github.com/plone/plone.reload/commit/4206297519fab5153accacfb409ce83801708861 +Date: 2018-10-04T14:31:18+02:00 +Author: Jan Mevissen (jmevissen) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/670e942680933d0123662ea81799947c2140572e -Remove trailing spaces +update for python3 Files changed: -M plone/reload/zcml.py +M src/plone/app/debugtoolbar/browser/global.py +M src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js -b"diff --git a/plone/reload/zcml.py b/plone/reload/zcml.py\nindex 74e5438..c2a7896 100644\n--- a/plone/reload/zcml.py\n+++ b/plone/reload/zcml.py\n@@ -17,7 +17,7 @@\n 'Products.Five.fiveconfigure',\n 'Products.Five.sizeconfigure',\n 'zope.component.globalregistry',\n- 'zope.component.hooks', \n+ 'zope.component.hooks',\n 'zope.schema.vocabulary',\n 'zope.security.management',\n 'zope.security.checker',\n" +b'diff --git a/src/plone/app/debugtoolbar/browser/global.py b/src/plone/app/debugtoolbar/browser/global.py\nindex e035e7b..7f160bd 100644\n--- a/src/plone/app/debugtoolbar/browser/global.py\n+++ b/src/plone/app/debugtoolbar/browser/global.py\n@@ -1,5 +1,6 @@\n # -*- coding: utf-8 -*-\n from zope.viewlet.viewlet import ViewletBase\n+from zc.lockfile import LockError\n \n class GlobalViewlet(ViewletBase):\n \n@@ -20,25 +21,42 @@ def update(self):\n \n self.config.append((name, getattr(config, name)))\n \n- self.servers = config.servers\n+ # BBB: import for Zope2\n+ # TODO servers info not available or in a different place?\n+ try:\n+ self.servers = config.servers\n+ except AttributeError:\n+ self.servers = []\n \n+ # BBB: import for Zope2\n try:\n self.appInfo = self.context.getPhysicalRoot()[\'Control_Panel\']\n except KeyError:\n- # bbb import for Zope2\n self.appInfo = self.context.getPhysicalRoot().Control_Panel\n \n self.databases = []\n paths = dict([(x[1], x[0],) for x in config.dbtab.mount_paths.items()])\n \n- for name in self.appInfo.Database.getDatabaseNames():\n- db = self.appInfo.Database[name]\n- dbtabEntry = config.dbtab.databases[name]\n-\n- self.databases.append({\n- \'name\': name,\n- \'location\': db.db_name(),\n- \'size\': db.db_size(),\n- \'cacheSize\': dbtabEntry.getCacheSize(),\n- \'mount\': paths.get(name, None),\n- })\n+ for db in config.databases:\n+ name = db.name\n+ # BBB: import for Zope2\n+ try:\n+ real_db = self.appInfo.Database[name]\n+ dbtabEntry = config.dbtab.databases[name]\n+\n+ self.databases.append({\n+ \'name\': name,\n+ \'location\': real_db.db_name(),\n+ \'size\': real_db.db_size(),\n+ \'cacheSize\': dbtabEntry.getCacheSize(),\n+ \'mount\': paths.get(name, None),\n+ })\n+ except LockError:\n+ db_config = db.config\n+ self.databases.append({\n+ \'name\': name,\n+ \'location\': \'TODO could not access db\',\n+ \'size\': \'TODO could not access db\',\n+ \'cacheSize\': db_config.cache_size,\n+ \'mount\': paths.get(name, None),\n+ })\ndiff --git a/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js b/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js\nindex e119553..19ca8f8 100644\n--- a/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js\n+++ b/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js\n@@ -26,7 +26,8 @@ function InteractivePrompt(target, path) {\n this.historyPosition = -1;\n \n if (path == undefined) {\n- path = "./@@plone.app.debugtoolbar.interactive.response";\n+ // path = "./@@plone.app.debugtoolbar.interactive.response";\n+ path = location.href + "/@@plone.app.debugtoolbar.interactive.response"; \n }\n this.path = path;\n };\n@@ -53,7 +54,8 @@ function TalesTester(target, path) {\n this.historyPosition = -1;\n \n if (path == undefined) {\n- path = "./@@plone.app.debugtoolbar.interactive.tales";\n+ // path = "./@@plone.app.debugtoolbar.interactive.tales";\n+ path = location.href + "/@@plone.app.debugtoolbar.interactive.tales"; \n }\n this.path = path;\n };\n' -Repository: plone.reload +Repository: plone.app.debugtoolbar Branch: refs/heads/master -Date: 2018-10-05T14:56:52+02:00 -Author: ale-rt (ale-rt) -Commit: https://github.com/plone/plone.reload/commit/2e84210460d9121972e591bdf58eed7b8168b64c +Date: 2018-10-05T10:59:05+02:00 +Author: Jan Mevissen (jmevissen) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/288aef4fa9916be1e5359b5380dfb120b1c087c5 + +do not show server listing if servers not available + +Files changed: +M src/plone/app/debugtoolbar/browser/global.pt + +b'diff --git a/src/plone/app/debugtoolbar/browser/global.pt b/src/plone/app/debugtoolbar/browser/global.pt\nindex c32ba4d..c2530b2 100644\n--- a/src/plone/app/debugtoolbar/browser/global.pt\n+++ b/src/plone/app/debugtoolbar/browser/global.pt\n@@ -17,24 +17,26 @@\n This panel shows information about the Zope server where Plone is running.\n

\n \n-

Servers

\n+ \n+

Servers

\n \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
NameIPPort
\n-
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
NameIPPort
\n+
\n+
\n \n

Environment

\n \n' + +Repository: plone.app.debugtoolbar -Add a changelog line + +Branch: refs/heads/master +Date: 2018-10-05T11:21:10+02:00 +Author: Jan Mevissen (jmevissen) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/b3b411ba5f390eddac442b01e5ce0ff87feaa5fd + +comment on database lock error + +Files changed: +M src/plone/app/debugtoolbar/browser/global.py + +b"diff --git a/src/plone/app/debugtoolbar/browser/global.py b/src/plone/app/debugtoolbar/browser/global.py\nindex 7f160bd..d716319 100644\n--- a/src/plone/app/debugtoolbar/browser/global.py\n+++ b/src/plone/app/debugtoolbar/browser/global.py\n@@ -22,7 +22,6 @@ def update(self):\n self.config.append((name, getattr(config, name)))\n \n # BBB: import for Zope2\n- # TODO servers info not available or in a different place?\n try:\n self.servers = config.servers\n except AttributeError:\n@@ -52,6 +51,8 @@ def update(self):\n 'mount': paths.get(name, None),\n })\n except LockError:\n+ # lock error when trying to access database\n+ # https://github.com/zopefoundation/Zope/issues/360\n db_config = db.config\n self.databases.append({\n 'name': name,\n" + +Repository: plone.app.debugtoolbar + + +Branch: refs/heads/master +Date: 2018-10-05T12:34:35+02:00 +Author: Jan Mevissen (jmevissen) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/49e79a3c7d40bff9229339cad9518d3dcf2a1989 + +unhide debugtoolbar viewlets on reinstall + +Files changed: +M src/plone/app/debugtoolbar/profiles/default/viewlets.xml + +b'diff --git a/src/plone/app/debugtoolbar/profiles/default/viewlets.xml b/src/plone/app/debugtoolbar/profiles/default/viewlets.xml\nindex 973edf3..f508b7b 100644\n--- a/src/plone/app/debugtoolbar/profiles/default/viewlets.xml\n+++ b/src/plone/app/debugtoolbar/profiles/default/viewlets.xml\n@@ -14,4 +14,5 @@\n \n \n \n+ \n \n' + +Repository: plone.app.debugtoolbar + + +Branch: refs/heads/master +Date: 2018-10-05T12:42:34+02:00 +Author: Jan Mevissen (jmevissen) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/dd2e59ff92f3e87a0fc4befa58050c17ac39313b + +Prepare for Python 2 / 3 compatibility Files changed: M CHANGES.rst +M setup.py -b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 81d4042..2ad19c7 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -4,6 +4,8 @@ Changelog\n 3.0.0 (unreleased)\n ------------------\n \n+- Call invalidate_caches and remove the __pycache__ in Python 3\n+\n - Add Python 3.4, 3.5 and 3.6 support. Drop Python 2.6 support.\n \n - Test against Zope 4, while keeping compatibility with Zope 2.13.\n' +b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 5f7629c..139413e 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -4,6 +4,8 @@ Changelog\n 1.1.5 (unreleased)\n ------------------\n \n+Prepare for Python 2 / 3 compatibility [jmevissen]\n+\n Breaking changes:\n \n - *add item here*\ndiff --git a/setup.py b/setup.py\nindex d3046a1..057d1c9 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -29,6 +29,8 @@\n "License :: OSI Approved :: GNU General Public License (GPL)",\n "Programming Language :: Python",\n "Programming Language :: Python :: 2.7",\n+ "Programming Language :: Python :: 3.6",\n+ "Programming Language :: Python :: 3.7",\n ],\n keywords=\'plone debug toolbar\',\n author=\'Martin Aspeli\',\n@@ -46,6 +48,7 @@\n \'zope.annotation\',\n \'plone.transformchain\',\n \'Paste\',\n+ \'six\'\n ],\n extras_require={\'test\': [\'plone.app.testing\']},\n entry_points="""\n' -Repository: plone.reload +Repository: plone.app.debugtoolbar Branch: refs/heads/master -Date: 2018-10-23T11:22:35+02:00 +Date: 2018-10-05T15:25:03+02:00 +Author: ale-rt (ale-rt) +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/c7ad4741f0d4f71e5679740f6bc1126c15c98607 + +Fix test setup + +Files changed: +M src/plone/app/debugtoolbar/testing.py +M src/plone/app/debugtoolbar/tests/test_setup.py +D src/plone/app/debugtoolbar/tests/test_example.py + +b'diff --git a/src/plone/app/debugtoolbar/testing.py b/src/plone/app/debugtoolbar/testing.py\nindex 113db01..8d7986c 100644\n--- a/src/plone/app/debugtoolbar/testing.py\n+++ b/src/plone/app/debugtoolbar/testing.py\n@@ -1,11 +1,9 @@\n # -*- coding: utf-8 -*-\n+from plone.app.testing import applyProfile\n+from plone.app.testing import IntegrationTesting\n from plone.app.testing import PLONE_FIXTURE\n from plone.app.testing import PloneSandboxLayer\n-from plone.app.testing import IntegrationTesting\n-from plone.app.testing import FunctionalTesting\n-from plone.app.testing import applyProfile\n \n-from zope.configuration import xmlconfig\n \n class PloneAppDebugtoolbar(PloneSandboxLayer):\n \n@@ -14,15 +12,14 @@ class PloneAppDebugtoolbar(PloneSandboxLayer):\n def setUpZope(self, app, configurationContext):\n # Load ZCML for this package\n import plone.app.debugtoolbar\n- xmlconfig.file(\'configure.zcml\',\n- plone.app.debugtoolbar,\n- context=configurationContext)\n-\n+ self.loadZCML(package=plone.app.debugtoolbar)\n \n def setUpPloneSite(self, portal):\n applyProfile(portal, \'plone.app.debugtoolbar:default\')\n \n+\n PLONE_APP_DEBUGTOOLBAR_FIXTURE = PloneAppDebugtoolbar()\n-PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING = \\\n- IntegrationTesting(bases=(PLONE_APP_DEBUGTOOLBAR_FIXTURE, ),\n- name="PloneAppDebugtoolbar:Integration")\n\\ No newline at end of file\n+PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING = IntegrationTesting(\n+ bases=(PLONE_APP_DEBUGTOOLBAR_FIXTURE, ),\n+ name="PloneAppDebugtoolbar:Integration",\n+)\ndiff --git a/src/plone/app/debugtoolbar/tests/test_example.py b/src/plone/app/debugtoolbar/tests/test_example.py\ndeleted file mode 100644\nindex deabaab..0000000\n--- a/src/plone/app/debugtoolbar/tests/test_example.py\n+++ /dev/null\n@@ -1,26 +0,0 @@\n-# -*- coding: utf-8 -*-\n-import unittest\n-\n-from Products.CMFCore.utils import getToolByName\n-\n-from plone.app.debugtoolbar.testing import\\\n- PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n-\n-\n-class TestSetup(unittest.TestCase):\n-\n- layer = PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n- \n- def setUp(self):\n- self.app = self.layer[\'app\']\n- self.portal = self.layer[\'portal\']\n- self.qi_tool = getToolByName(self.portal, \'portal_quickinstaller\')\n- \n- def test_product_is_installed(self):\n- """ Validate that our products GS profile has been run and the product \n- installed\n- """\n- pid = \'plone.app.debugtoolbar\'\n- installed = [p[\'id\'] for p in self.qi_tool.listInstalledProducts()]\n- self.assertTrue(pid in installed,\n- \'package appears not to have been installed\')\ndiff --git a/src/plone/app/debugtoolbar/tests/test_setup.py b/src/plone/app/debugtoolbar/tests/test_setup.py\nindex 686cc19..ef8168c 100644\n--- a/src/plone/app/debugtoolbar/tests/test_setup.py\n+++ b/src/plone/app/debugtoolbar/tests/test_setup.py\n@@ -1,26 +1,26 @@\n # -*- coding: utf-8 -*-\n-import unittest\n-\n-from Products.CMFCore.utils import getToolByName\n+from plone.app.debugtoolbar.testing import PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING # noqa: E501\n+from Products.CMFPlone.utils import get_installer\n \n-from plone.app.debugtoolbar.testing import\\\n- PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n+import unittest\n \n \n-class TestExample(unittest.TestCase):\n+class TestSetup(unittest.TestCase):\n \n layer = PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n- \n+\n def setUp(self):\n self.app = self.layer[\'app\']\n self.portal = self.layer[\'portal\']\n- self.qi_tool = getToolByName(self.portal, \'portal_quickinstaller\')\n- \n+ self.request = self.layer[\'request\']\n+ self.qi_tool = get_installer(self.portal, self.request)\n+\n def test_product_is_installed(self):\n- """ Validate that our products GS profile has been run and the product \n+ """ Validate that our products GS profile has been run and the product\n installed\n """\n pid = \'plone.app.debugtoolbar\'\n- installed = [p[\'id\'] for p in self.qi_tool.listInstalledProducts()]\n- self.assertTrue(pid in installed,\n- \'package appears not to have been installed\')\n+ self.assertTrue(\n+ self.qi_tool.is_product_installed(pid),\n+ \'package appears not to have been installed\',\n+ )\n' + +Repository: plone.app.debugtoolbar + + +Branch: refs/heads/master +Date: 2018-10-23T11:25:30+02:00 Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/plone.reload/commit/9f1db892d2c7ee99f4ab7f0ffa27059b5e69858d +Commit: https://github.com/plone/plone.app.debugtoolbar/commit/264dbefded53d530c3664027148a40b1a41b7a5d -Merge pull request #9 from plone/python3 +Merge pull request #20 from plone/python3 Python3 Files changed: M CHANGES.rst -M plone/reload/tests/test_reload.py -M plone/reload/zcml.py - -b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex 81d4042..2ad19c7 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -4,6 +4,8 @@ Changelog\n 3.0.0 (unreleased)\n ------------------\n \n+- Call invalidate_caches and remove the __pycache__ in Python 3\n+\n - Add Python 3.4, 3.5 and 3.6 support. Drop Python 2.6 support.\n \n - Test against Zope 4, while keeping compatibility with Zope 2.13.\ndiff --git a/plone/reload/tests/test_reload.py b/plone/reload/tests/test_reload.py\nindex 1707c82..fbc51f4 100644\n--- a/plone/reload/tests/test_reload.py\n+++ b/plone/reload/tests/test_reload.py\n@@ -1,6 +1,8 @@\n import os\n+import shutil\n import tempfile\n import unittest\n+import importlib\n \n from plone.reload import xreload\n \n@@ -21,6 +23,11 @@ def _create_temp(self):\n fd.close()\n name = os.path.split(temp.name)[-1]\n modulename = 'plone.reload.tests.data.' + name[:-3]\n+ try:\n+ importlib.invalidate_caches()\n+ except AttributeError:\n+ # invalidate_caches was introduced in Python 3.3\n+ pass\n module = __import__(modulename,\n fromlist=['plone', 'reload', 'tests', 'data'])\n return temp.name, module\n@@ -47,6 +54,10 @@ def tearDown(self):\n if os.path.isfile(data_init + 'c'):\n os.unlink(data_init + 'c')\n \n+ data_pycache = os.path.join(TESTS, '__pycache__')\n+ if os.path.isdir(data_pycache):\n+ shutil.rmtree(data_pycache)\n+\n \n class TestReloadModule(TestReload):\n \ndiff --git a/plone/reload/zcml.py b/plone/reload/zcml.py\nindex afc1321..c2a7896 100644\n--- a/plone/reload/zcml.py\n+++ b/plone/reload/zcml.py\n@@ -17,6 +17,7 @@\n 'Products.Five.fiveconfigure',\n 'Products.Five.sizeconfigure',\n 'zope.component.globalregistry',\n+ 'zope.component.hooks',\n 'zope.schema.vocabulary',\n 'zope.security.management',\n 'zope.security.checker',\n" +M bootstrap.py +M setup.py +M src/plone/app/debugtoolbar/browser/context.py +M src/plone/app/debugtoolbar/browser/global.pt +M src/plone/app/debugtoolbar/browser/global.py +M src/plone/app/debugtoolbar/browser/interactive.py +M src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js +M src/plone/app/debugtoolbar/profiles/default/viewlets.xml +M src/plone/app/debugtoolbar/testing.py +M src/plone/app/debugtoolbar/tests/test_setup.py +D src/plone/app/debugtoolbar/tests/test_example.py + +b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 5f7629c..139413e 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -4,6 +4,8 @@ Changelog\n 1.1.5 (unreleased)\n ------------------\n \n+Prepare for Python 2 / 3 compatibility [jmevissen]\n+\n Breaking changes:\n \n - *add item here*\ndiff --git a/bootstrap.py b/bootstrap.py\nindex a459921..7324ba4 100644\n--- a/bootstrap.py\n+++ b/bootstrap.py\n@@ -18,6 +18,7 @@\n use the -c option to specify an alternate configuration file.\n """\n \n+from __future__ import print_function\n import os\n import shutil\n import sys\n@@ -73,7 +74,7 @@\n \n options, args = parser.parse_args()\n if options.version:\n- print("bootstrap.py version %s" % __version__)\n+ print(("bootstrap.py version %s" % __version__))\n sys.exit(0)\n \n \n@@ -83,7 +84,7 @@\n try:\n from urllib.request import urlopen\n except ImportError:\n- from urllib2 import urlopen\n+ from six.moves.urllib.request import urlopen\n \n ez = {}\n if os.path.exists(\'ez_setup.py\'):\ndiff --git a/setup.py b/setup.py\nindex d3046a1..057d1c9 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -29,6 +29,8 @@\n "License :: OSI Approved :: GNU General Public License (GPL)",\n "Programming Language :: Python",\n "Programming Language :: Python :: 2.7",\n+ "Programming Language :: Python :: 3.6",\n+ "Programming Language :: Python :: 3.7",\n ],\n keywords=\'plone debug toolbar\',\n author=\'Martin Aspeli\',\n@@ -46,6 +48,7 @@\n \'zope.annotation\',\n \'plone.transformchain\',\n \'Paste\',\n+ \'six\'\n ],\n extras_require={\'test\': [\'plone.app.testing\']},\n entry_points="""\ndiff --git a/src/plone/app/debugtoolbar/browser/context.py b/src/plone/app/debugtoolbar/browser/context.py\nindex 3a8e6ee..977d14d 100644\n--- a/src/plone/app/debugtoolbar/browser/context.py\n+++ b/src/plone/app/debugtoolbar/browser/context.py\n@@ -1,6 +1,7 @@\n # -*- coding: utf-8 -*-\n import types\n import inspect\n+import six\n \n from zope.interface import Interface\n from zope.interface import providedBy, directlyProvidedBy\n@@ -44,7 +45,7 @@ def update(self):\n generator = getAdapters((self.context, self.request,), Interface)\n while True:\n try:\n- name, view = generator.next()\n+ name, view = next(generator)\n \n if not IView.providedBy(view):\n continue\n@@ -94,7 +95,7 @@ def update(self):\n continue\n \n # FIXME: Should we include ComputedAttribute here ? [glenfant]\n- if isinstance(attr, (int, long, float, basestring, bool, list, tuple, dict, set, frozenset)):\n+ if isinstance(attr, (int, float, six.string_types, bool, list, tuple, dict, set, frozenset)):\n self.variables.append({\n \'name\': name,\n \'primitive\': True,\ndiff --git a/src/plone/app/debugtoolbar/browser/global.pt b/src/plone/app/debugtoolbar/browser/global.pt\nindex 55578b5..c2530b2 100644\n--- a/src/plone/app/debugtoolbar/browser/global.pt\n+++ b/src/plone/app/debugtoolbar/browser/global.pt\n@@ -17,24 +17,26 @@\n This panel shows information about the Zope server where Plone is running.\n

\n \n-

Servers

\n+ \n+

Servers

\n \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
NameIPPort
\n-
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
NameIPPort
\n+
\n+
\n \n

Environment

\n \n@@ -52,7 +54,7 @@\n Process\n \n \n- \n+ \n Running for\n \n \ndiff --git a/src/plone/app/debugtoolbar/browser/global.py b/src/plone/app/debugtoolbar/browser/global.py\nindex 25cd452..d716319 100644\n--- a/src/plone/app/debugtoolbar/browser/global.py\n+++ b/src/plone/app/debugtoolbar/browser/global.py\n@@ -1,5 +1,6 @@\n # -*- coding: utf-8 -*-\n from zope.viewlet.viewlet import ViewletBase\n+from zc.lockfile import LockError\n \n class GlobalViewlet(ViewletBase):\n \n@@ -20,21 +21,43 @@ def update(self):\n \n self.config.append((name, getattr(config, name)))\n \n- self.servers = config.servers\n+ # BBB: import for Zope2\n+ try:\n+ self.servers = config.servers\n+ except AttributeError:\n+ self.servers = []\n \n- self.appInfo = self.context.getPhysicalRoot()[\'Control_Panel\']\n+ # BBB: import for Zope2\n+ try:\n+ self.appInfo = self.context.getPhysicalRoot()[\'Control_Panel\']\n+ except KeyError:\n+ self.appInfo = self.context.getPhysicalRoot().Control_Panel\n \n self.databases = []\n paths = dict([(x[1], x[0],) for x in config.dbtab.mount_paths.items()])\n \n- for name in self.appInfo.Database.getDatabaseNames():\n- db = self.appInfo.Database[name]\n- dbtabEntry = config.dbtab.databases[name]\n-\n- self.databases.append({\n- \'name\': name,\n- \'location\': db.db_name(),\n- \'size\': db.db_size(),\n- \'cacheSize\': dbtabEntry.getCacheSize(),\n- \'mount\': paths.get(name, None),\n- })\n+ for db in config.databases:\n+ name = db.name\n+ # BBB: import for Zope2\n+ try:\n+ real_db = self.appInfo.Database[name]\n+ dbtabEntry = config.dbtab.databases[name]\n+\n+ self.databases.append({\n+ \'name\': name,\n+ \'location\': real_db.db_name(),\n+ \'size\': real_db.db_size(),\n+ \'cacheSize\': dbtabEntry.getCacheSize(),\n+ \'mount\': paths.get(name, None),\n+ })\n+ except LockError:\n+ # lock error when trying to access database\n+ # https://github.com/zopefoundation/Zope/issues/360\n+ db_config = db.config\n+ self.databases.append({\n+ \'name\': name,\n+ \'location\': \'TODO could not access db\',\n+ \'size\': \'TODO could not access db\',\n+ \'cacheSize\': db_config.cache_size,\n+ \'mount\': paths.get(name, None),\n+ })\ndiff --git a/src/plone/app/debugtoolbar/browser/interactive.py b/src/plone/app/debugtoolbar/browser/interactive.py\nindex 6e2a698..05d7605 100644\n--- a/src/plone/app/debugtoolbar/browser/interactive.py\n+++ b/src/plone/app/debugtoolbar/browser/interactive.py\n@@ -3,6 +3,7 @@\n import cgi\n import threading\n import traceback\n+import six\n \n from zope.component import queryMultiAdapter\n from zope.publisher.browser import BrowserView\n@@ -133,7 +134,7 @@ def __call__(self):\n except:\n output = "%s" % traceback.format_exc()\n \n- if isinstance(output, unicode):\n+ if isinstance(output, six.text_type):\n output = output.encode(\'ascii\', \'xmlcharrefreplace\')\n elif not isinstance(output, str):\n output = repr(output)\ndiff --git a/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js b/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js\nindex e119553..19ca8f8 100644\n--- a/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js\n+++ b/src/plone/app/debugtoolbar/browser/resources/debugtoolbar.js\n@@ -26,7 +26,8 @@ function InteractivePrompt(target, path) {\n this.historyPosition = -1;\n \n if (path == undefined) {\n- path = "./@@plone.app.debugtoolbar.interactive.response";\n+ // path = "./@@plone.app.debugtoolbar.interactive.response";\n+ path = location.href + "/@@plone.app.debugtoolbar.interactive.response"; \n }\n this.path = path;\n };\n@@ -53,7 +54,8 @@ function TalesTester(target, path) {\n this.historyPosition = -1;\n \n if (path == undefined) {\n- path = "./@@plone.app.debugtoolbar.interactive.tales";\n+ // path = "./@@plone.app.debugtoolbar.interactive.tales";\n+ path = location.href + "/@@plone.app.debugtoolbar.interactive.tales"; \n }\n this.path = path;\n };\ndiff --git a/src/plone/app/debugtoolbar/profiles/default/viewlets.xml b/src/plone/app/debugtoolbar/profiles/default/viewlets.xml\nindex 973edf3..f508b7b 100644\n--- a/src/plone/app/debugtoolbar/profiles/default/viewlets.xml\n+++ b/src/plone/app/debugtoolbar/profiles/default/viewlets.xml\n@@ -14,4 +14,5 @@\n \n \n \n+ \n \ndiff --git a/src/plone/app/debugtoolbar/testing.py b/src/plone/app/debugtoolbar/testing.py\nindex 113db01..8d7986c 100644\n--- a/src/plone/app/debugtoolbar/testing.py\n+++ b/src/plone/app/debugtoolbar/testing.py\n@@ -1,11 +1,9 @@\n # -*- coding: utf-8 -*-\n+from plone.app.testing import applyProfile\n+from plone.app.testing import IntegrationTesting\n from plone.app.testing import PLONE_FIXTURE\n from plone.app.testing import PloneSandboxLayer\n-from plone.app.testing import IntegrationTesting\n-from plone.app.testing import FunctionalTesting\n-from plone.app.testing import applyProfile\n \n-from zope.configuration import xmlconfig\n \n class PloneAppDebugtoolbar(PloneSandboxLayer):\n \n@@ -14,15 +12,14 @@ class PloneAppDebugtoolbar(PloneSandboxLayer):\n def setUpZope(self, app, configurationContext):\n # Load ZCML for this package\n import plone.app.debugtoolbar\n- xmlconfig.file(\'configure.zcml\',\n- plone.app.debugtoolbar,\n- context=configurationContext)\n-\n+ self.loadZCML(package=plone.app.debugtoolbar)\n \n def setUpPloneSite(self, portal):\n applyProfile(portal, \'plone.app.debugtoolbar:default\')\n \n+\n PLONE_APP_DEBUGTOOLBAR_FIXTURE = PloneAppDebugtoolbar()\n-PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING = \\\n- IntegrationTesting(bases=(PLONE_APP_DEBUGTOOLBAR_FIXTURE, ),\n- name="PloneAppDebugtoolbar:Integration")\n\\ No newline at end of file\n+PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING = IntegrationTesting(\n+ bases=(PLONE_APP_DEBUGTOOLBAR_FIXTURE, ),\n+ name="PloneAppDebugtoolbar:Integration",\n+)\ndiff --git a/src/plone/app/debugtoolbar/tests/test_example.py b/src/plone/app/debugtoolbar/tests/test_example.py\ndeleted file mode 100644\nindex deabaab..0000000\n--- a/src/plone/app/debugtoolbar/tests/test_example.py\n+++ /dev/null\n@@ -1,26 +0,0 @@\n-# -*- coding: utf-8 -*-\n-import unittest\n-\n-from Products.CMFCore.utils import getToolByName\n-\n-from plone.app.debugtoolbar.testing import\\\n- PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n-\n-\n-class TestSetup(unittest.TestCase):\n-\n- layer = PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n- \n- def setUp(self):\n- self.app = self.layer[\'app\']\n- self.portal = self.layer[\'portal\']\n- self.qi_tool = getToolByName(self.portal, \'portal_quickinstaller\')\n- \n- def test_product_is_installed(self):\n- """ Validate that our products GS profile has been run and the product \n- installed\n- """\n- pid = \'plone.app.debugtoolbar\'\n- installed = [p[\'id\'] for p in self.qi_tool.listInstalledProducts()]\n- self.assertTrue(pid in installed,\n- \'package appears not to have been installed\')\ndiff --git a/src/plone/app/debugtoolbar/tests/test_setup.py b/src/plone/app/debugtoolbar/tests/test_setup.py\nindex 686cc19..ef8168c 100644\n--- a/src/plone/app/debugtoolbar/tests/test_setup.py\n+++ b/src/plone/app/debugtoolbar/tests/test_setup.py\n@@ -1,26 +1,26 @@\n # -*- coding: utf-8 -*-\n-import unittest\n-\n-from Products.CMFCore.utils import getToolByName\n+from plone.app.debugtoolbar.testing import PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING # noqa: E501\n+from Products.CMFPlone.utils import get_installer\n \n-from plone.app.debugtoolbar.testing import\\\n- PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n+import unittest\n \n \n-class TestExample(unittest.TestCase):\n+class TestSetup(unittest.TestCase):\n \n layer = PLONE_APP_DEBUGTOOLBAR_INTEGRATION_TESTING\n- \n+\n def setUp(self):\n self.app = self.layer[\'app\']\n self.portal = self.layer[\'portal\']\n- self.qi_tool = getToolByName(self.portal, \'portal_quickinstaller\')\n- \n+ self.request = self.layer[\'request\']\n+ self.qi_tool = get_installer(self.portal, self.request)\n+\n def test_product_is_installed(self):\n- """ Validate that our products GS profile has been run and the product \n+ """ Validate that our products GS profile has been run and the product\n installed\n """\n pid = \'plone.app.debugtoolbar\'\n- installed = [p[\'id\'] for p in self.qi_tool.listInstalledProducts()]\n- self.assertTrue(pid in installed,\n- \'package appears not to have been installed\')\n+ self.assertTrue(\n+ self.qi_tool.is_product_installed(pid),\n+ \'package appears not to have been installed\',\n+ )\n'