Skip to content

Commit

Permalink
[fc] Repository: plone.recipe.zope2instance
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2019-05-02T11:01:42-05:00
Author: Jens Vagelpohl (dataflake) <[email protected]>
Commit: plone/plone.recipe.zope2instance@753386b

Add support for the new ``debug-exceptions`` flag in Zope

Files changed:
A news/100.feature
M README.rst
M src/plone/recipe/zope2instance/recipe.py
M src/plone/recipe/zope2instance/tests/test_wsgischema.py
M src/plone/recipe/zope2instance/tests/zope2instance.txt
M src/plone/recipe/zope2instance/wsgischema.xml
Repository: plone.recipe.zope2instance

Branch: refs/heads/master
Date: 2019-05-02T11:43:57-05:00
Author: Jens Vagelpohl (dataflake) <[email protected]>
Commit: plone/plone.recipe.zope2instance@9d3bfb2

- try to fix tox

Files changed:
M tox.ini
Repository: plone.recipe.zope2instance

Branch: refs/heads/master
Date: 2019-05-02T21:23:53+02:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: plone/plone.recipe.zope2instance@8c4ef73

Merge pull request #101 from plone/issue_100

Add support for the new ``debug-exceptions`` flag in Zope

Files changed:
A news/100.feature
M README.rst
M src/plone/recipe/zope2instance/recipe.py
M src/plone/recipe/zope2instance/tests/test_wsgischema.py
M src/plone/recipe/zope2instance/tests/zope2instance.txt
M src/plone/recipe/zope2instance/wsgischema.xml
  • Loading branch information
mauritsvanrees committed May 2, 2019
1 parent 711ad03 commit 40b44c4
Showing 1 changed file with 35 additions and 10 deletions.
45 changes: 35 additions & 10 deletions last_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,56 @@ Repository: plone.recipe.zope2instance


Branch: refs/heads/master
Date: 2019-04-27T16:56:20+02:00
Author: Jürgen Gmach (jugmac00) <[email protected]>
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/50a029364bd341ebabff2848beeed1ea317eeb87
Date: 2019-05-02T11:01:42-05:00
Author: Jens Vagelpohl (dataflake) <[email protected]>
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/753386b5ae062194a7b4e532a8b4c65ef685d584

Remove duplicate word.
Add support for the new ``debug-exceptions`` flag in Zope

Files changed:
A news/100.feature
M README.rst
M src/plone/recipe/zope2instance/recipe.py
M src/plone/recipe/zope2instance/tests/test_wsgischema.py
M src/plone/recipe/zope2instance/tests/zope2instance.txt
M src/plone/recipe/zope2instance/wsgischema.xml

b'diff --git a/README.rst b/README.rst\nindex 616ec8c..4dcdcb4 100644\n--- a/README.rst\n+++ b/README.rst\n@@ -10,7 +10,7 @@ Introduction\n This recipe creates and configures a Zope instance in parts.\n (Despite its name it nowadays only works for Zope 4+.) It also\n installs a control script, which is like zopectl, in the bin/ directory.\n-The name of the control script is the the name of the part in buildout.\n+The name of the control script is the name of the part in buildout.\n By default various runtime and log information will be stored inside the var/\n directory.\n \n'
b'diff --git a/README.rst b/README.rst\nindex 616ec8c..24938e2 100644\n--- a/README.rst\n+++ b/README.rst\n@@ -139,6 +139,16 @@ verbose-security\n Set to `on` to turn on verbose security (and switch to the Python security\n implementation). Defaults to `off` (and the C security implementation).\n \n+debug-exceptions\n+ WSGI only: set to `on` to disable exception views including\n+ ``standard_error_message``. Exceptions other than ``Unauthorized`` or\n+ ``ConflictError`` can then travel up into the WSGI stack. Use this option\n+ if you want more convenient error debugging offered by WSGI middleware\n+ such as the `werkzeug debugger\n+ <https://werkzeug.palletsprojects.com/en/0.15.x/debug/>`_. See the `Zope\n+ WSGI documentation <https://zope.readthedocs.io/en/latest/wsgi.html>`_ for\n+ examples.\n+\n Direct storage\n --------------\n \ndiff --git a/news/100.feature b/news/100.feature\nnew file mode 100644\nindex 0000000..a1c2d71\n--- /dev/null\n+++ b/news/100.feature\n@@ -0,0 +1 @@\n+Add support for the new ``debug-exceptions`` flag in Zope\ndiff --git a/src/plone/recipe/zope2instance/recipe.py b/src/plone/recipe/zope2instance/recipe.py\nindex 005b870..e4edc37 100644\n--- a/src/plone/recipe/zope2instance/recipe.py\n+++ b/src/plone/recipe/zope2instance/recipe.py\n@@ -212,6 +212,9 @@ def build_zope_conf(self):\n module_paths = [os.path.abspath(p) for p in module_paths]\n paths_lines = \'\\n\'.join([\'path %s\' % p for p in module_paths])\n debug_mode = options.get(\'debug-mode\', \'off\')\n+ debug_exceptions = options.get(\'debug-exceptions\', \'\')\n+ if debug_exceptions:\n+ debug_exceptions = debug_exceptions_template % debug_exceptions\n security_implementation = \'C\'\n verbose_security = options.get(\'verbose-security\', \'off\')\n if verbose_security == \'on\':\n@@ -628,6 +631,7 @@ def is_rs_option(name):\n paths_lines=paths_lines,\n products_lines=products_lines,\n debug_mode=debug_mode,\n+ debug_exceptions=debug_exceptions,\n security_implementation=security_implementation,\n verbose_security=verbose_security,\n effective_user=effective_user,\n@@ -1054,6 +1058,10 @@ def render_file_storage(self, file_storage, blob_storage,\n </zodb_db>\n """.strip()\n \n+debug_exceptions_template = """\\\n+debug-exceptions %s\n+"""\n+\n http_force_connection_close_template = """\\\n force-connection-close %s\n """.rstrip()\n@@ -1173,6 +1181,7 @@ def render_file_storage(self, file_storage, blob_storage,\n clienthome $CLIENTHOME\n %(products_lines)s\n debug-mode %(debug_mode)s\n+%(debug_exceptions)s\n security-policy-implementation %(security_implementation)s\n verbose-security %(verbose_security)s\n %(default_zpublisher_encoding)s\ndiff --git a/src/plone/recipe/zope2instance/tests/test_wsgischema.py b/src/plone/recipe/zope2instance/tests/test_wsgischema.py\nindex 44cb947..4ec5d3e 100644\n--- a/src/plone/recipe/zope2instance/tests/test_wsgischema.py\n+++ b/src/plone/recipe/zope2instance/tests/test_wsgischema.py\n@@ -111,6 +111,19 @@ def test_max_conflict_retries_explicit(self):\n """)\n self.assertEqual(conf.max_conflict_retries, 15)\n \n+ def test_debug_exceptions_default(self):\n+ conf, handler = self.load_config_text("""\\\n+ instancehome <<INSTANCE_HOME>>\n+ """)\n+ self.assertFalse(conf.debug_exceptions)\n+\n+ def test_debug_exceptions_explicit(self):\n+ conf, handler = self.load_config_text("""\\\n+ instancehome <<INSTANCE_HOME>>\n+ debug-exceptions on\n+ """)\n+ self.assertTrue(conf.debug_exceptions)\n+\n def test_default_zpublisher_encoding(self):\n conf, dummy = self.load_config_text("""\\\n instancehome <<INSTANCE_HOME>>\ndiff --git a/src/plone/recipe/zope2instance/tests/zope2instance.txt b/src/plone/recipe/zope2instance/tests/zope2instance.txt\nindex c04feff..1d61647 100644\n--- a/src/plone/recipe/zope2instance/tests/zope2instance.txt\n+++ b/src/plone/recipe/zope2instance/tests/zope2instance.txt\n@@ -1715,3 +1715,41 @@ script::\n >>> "print(\'Initialization complete!\')" in instance\n True\n \n+\n+Exceptions debug mode\n+=====================\n+`debug-exceptions` disables exception views including\n+``standard_error_message`` and acts as a debugging aid during development.\n+\n+ >>> write(\'buildout.cfg\',\n+ ... \'\'\'\n+ ... [buildout]\n+ ... parts = instance\n+ ... find-links = %(sample_buildout)s/eggs\n+ ...\n+ ... [instance]\n+ ... recipe = plone.recipe.zope2instance\n+ ... eggs =\n+ ... user = me:me\n+ ... debug-exceptions = on\n+ ... \'\'\' % options)\n+\n+Let\'s run it::\n+\n+ >>> print(system(join(\'bin\', \'buildout\'))),\n+ Uninstalling instance.\n+ Installing instance.\n+ Generated script \'...instance\'.\n+ Generated interpreter \'.../parts/instance/bin/interpreter\'...\n+\n+Now zope.conf should include the debug-exceptions configuration:\n+\n+ >>> instance = os.path.join(sample_buildout, \'parts\', \'instance\')\n+ >>> zope_conf = open(os.path.join(instance, \'etc\', \'zope.conf\')).read()\n+ >>> zope_conf = zope_conf.replace(\'\\\\\', \'/\')\n+ >>> print(zope_conf)\n+ %define INSTANCEHOME .../sample-buildout/parts/instance\n+ ...\n+ debug-exceptions on\n+ ...\n+ <BLANKLINE>\ndiff --git a/src/plone/recipe/zope2instance/wsgischema.xml b/src/plone/recipe/zope2instance/wsgischema.xml\nindex 996394b..da68964 100644\n--- a/src/plone/recipe/zope2instance/wsgischema.xml\n+++ b/src/plone/recipe/zope2instance/wsgischema.xml\n@@ -276,6 +276,22 @@\n <metadefault>off</metadefault>\n </key>\n \n+ <key name="debug-exceptions" datatype="boolean" default="off">\n+ <description>\n+ This switch controls how exceptions are handled. If it is set to\n+ "off" (the default), Zope\'s own exception handling is active.\n+ Exception views or a standard_error_message are used to handle them.\n+\n+ If set to "on", exceptions are not handled by Zope and can propagate\n+ into the WSGI pipeline, where they may be handled by debugging\n+ middleware.\n+\n+ This setting should always be "off" in production. It is useful for\n+ developers and while debugging site issues.\n+ </description>\n+ <metadefault>off</metadefault>\n+ </key>\n+\n <key name="locale" datatype="locale" handler="locale">\n <description>\n Locale name to be used. See your operating system documentation for locale\n'

Repository: plone.recipe.zope2instance


Branch: refs/heads/master
Date: 2019-05-02T21:18:27+02:00
Date: 2019-05-02T11:43:57-05:00
Author: Jens Vagelpohl (dataflake) <[email protected]>
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/9d3bfb201a5bcf2e3f707cc8dca7fe8efdb4e7a4

- try to fix tox

Files changed:
M tox.ini

b'diff --git a/tox.ini b/tox.ini\nindex c718129..b5e8631 100644\n--- a/tox.ini\n+++ b/tox.ini\n@@ -10,6 +10,7 @@ skip_missing_interpreters = False\n \n [testenv]\n usedevelop = true\n+install_command = python -m pip install --no-use-pep517 {opts} {packages}\n commands =\n coverage run {envbindir}/zope-testrunner --test-path=src []\n extras = test\n'

Repository: plone.recipe.zope2instance


Branch: refs/heads/master
Date: 2019-05-02T21:23:53+02:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/eb3f54ec7ad890b4d990e00cfd6c13d80c706744
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/8c4ef73e93156644191c35475baab8ec90dad5f9

Merge pull request #99 from jugmac00/patch-1
Merge pull request #101 from plone/issue_100

Remove duplicate word.
Add support for the new ``debug-exceptions`` flag in Zope

Files changed:
A news/100.feature
M README.rst
M src/plone/recipe/zope2instance/recipe.py
M src/plone/recipe/zope2instance/tests/test_wsgischema.py
M src/plone/recipe/zope2instance/tests/zope2instance.txt
M src/plone/recipe/zope2instance/wsgischema.xml

b'diff --git a/README.rst b/README.rst\nindex 616ec8c..4dcdcb4 100644\n--- a/README.rst\n+++ b/README.rst\n@@ -10,7 +10,7 @@ Introduction\n This recipe creates and configures a Zope instance in parts.\n (Despite its name it nowadays only works for Zope 4+.) It also\n installs a control script, which is like zopectl, in the bin/ directory.\n-The name of the control script is the the name of the part in buildout.\n+The name of the control script is the name of the part in buildout.\n By default various runtime and log information will be stored inside the var/\n directory.\n \n'
b'diff --git a/README.rst b/README.rst\nindex 4dcdcb4..1980fa2 100644\n--- a/README.rst\n+++ b/README.rst\n@@ -139,6 +139,16 @@ verbose-security\n Set to `on` to turn on verbose security (and switch to the Python security\n implementation). Defaults to `off` (and the C security implementation).\n \n+debug-exceptions\n+ WSGI only: set to `on` to disable exception views including\n+ ``standard_error_message``. Exceptions other than ``Unauthorized`` or\n+ ``ConflictError`` can then travel up into the WSGI stack. Use this option\n+ if you want more convenient error debugging offered by WSGI middleware\n+ such as the `werkzeug debugger\n+ <https://werkzeug.palletsprojects.com/en/0.15.x/debug/>`_. See the `Zope\n+ WSGI documentation <https://zope.readthedocs.io/en/latest/wsgi.html>`_ for\n+ examples.\n+\n Direct storage\n --------------\n \ndiff --git a/news/100.feature b/news/100.feature\nnew file mode 100644\nindex 0000000..a1c2d71\n--- /dev/null\n+++ b/news/100.feature\n@@ -0,0 +1 @@\n+Add support for the new ``debug-exceptions`` flag in Zope\ndiff --git a/src/plone/recipe/zope2instance/recipe.py b/src/plone/recipe/zope2instance/recipe.py\nindex 005b870..e4edc37 100644\n--- a/src/plone/recipe/zope2instance/recipe.py\n+++ b/src/plone/recipe/zope2instance/recipe.py\n@@ -212,6 +212,9 @@ def build_zope_conf(self):\n module_paths = [os.path.abspath(p) for p in module_paths]\n paths_lines = \'\\n\'.join([\'path %s\' % p for p in module_paths])\n debug_mode = options.get(\'debug-mode\', \'off\')\n+ debug_exceptions = options.get(\'debug-exceptions\', \'\')\n+ if debug_exceptions:\n+ debug_exceptions = debug_exceptions_template % debug_exceptions\n security_implementation = \'C\'\n verbose_security = options.get(\'verbose-security\', \'off\')\n if verbose_security == \'on\':\n@@ -628,6 +631,7 @@ def is_rs_option(name):\n paths_lines=paths_lines,\n products_lines=products_lines,\n debug_mode=debug_mode,\n+ debug_exceptions=debug_exceptions,\n security_implementation=security_implementation,\n verbose_security=verbose_security,\n effective_user=effective_user,\n@@ -1054,6 +1058,10 @@ def render_file_storage(self, file_storage, blob_storage,\n </zodb_db>\n """.strip()\n \n+debug_exceptions_template = """\\\n+debug-exceptions %s\n+"""\n+\n http_force_connection_close_template = """\\\n force-connection-close %s\n """.rstrip()\n@@ -1173,6 +1181,7 @@ def render_file_storage(self, file_storage, blob_storage,\n clienthome $CLIENTHOME\n %(products_lines)s\n debug-mode %(debug_mode)s\n+%(debug_exceptions)s\n security-policy-implementation %(security_implementation)s\n verbose-security %(verbose_security)s\n %(default_zpublisher_encoding)s\ndiff --git a/src/plone/recipe/zope2instance/tests/test_wsgischema.py b/src/plone/recipe/zope2instance/tests/test_wsgischema.py\nindex 44cb947..4ec5d3e 100644\n--- a/src/plone/recipe/zope2instance/tests/test_wsgischema.py\n+++ b/src/plone/recipe/zope2instance/tests/test_wsgischema.py\n@@ -111,6 +111,19 @@ def test_max_conflict_retries_explicit(self):\n """)\n self.assertEqual(conf.max_conflict_retries, 15)\n \n+ def test_debug_exceptions_default(self):\n+ conf, handler = self.load_config_text("""\\\n+ instancehome <<INSTANCE_HOME>>\n+ """)\n+ self.assertFalse(conf.debug_exceptions)\n+\n+ def test_debug_exceptions_explicit(self):\n+ conf, handler = self.load_config_text("""\\\n+ instancehome <<INSTANCE_HOME>>\n+ debug-exceptions on\n+ """)\n+ self.assertTrue(conf.debug_exceptions)\n+\n def test_default_zpublisher_encoding(self):\n conf, dummy = self.load_config_text("""\\\n instancehome <<INSTANCE_HOME>>\ndiff --git a/src/plone/recipe/zope2instance/tests/zope2instance.txt b/src/plone/recipe/zope2instance/tests/zope2instance.txt\nindex c04feff..1d61647 100644\n--- a/src/plone/recipe/zope2instance/tests/zope2instance.txt\n+++ b/src/plone/recipe/zope2instance/tests/zope2instance.txt\n@@ -1715,3 +1715,41 @@ script::\n >>> "print(\'Initialization complete!\')" in instance\n True\n \n+\n+Exceptions debug mode\n+=====================\n+`debug-exceptions` disables exception views including\n+``standard_error_message`` and acts as a debugging aid during development.\n+\n+ >>> write(\'buildout.cfg\',\n+ ... \'\'\'\n+ ... [buildout]\n+ ... parts = instance\n+ ... find-links = %(sample_buildout)s/eggs\n+ ...\n+ ... [instance]\n+ ... recipe = plone.recipe.zope2instance\n+ ... eggs =\n+ ... user = me:me\n+ ... debug-exceptions = on\n+ ... \'\'\' % options)\n+\n+Let\'s run it::\n+\n+ >>> print(system(join(\'bin\', \'buildout\'))),\n+ Uninstalling instance.\n+ Installing instance.\n+ Generated script \'...instance\'.\n+ Generated interpreter \'.../parts/instance/bin/interpreter\'...\n+\n+Now zope.conf should include the debug-exceptions configuration:\n+\n+ >>> instance = os.path.join(sample_buildout, \'parts\', \'instance\')\n+ >>> zope_conf = open(os.path.join(instance, \'etc\', \'zope.conf\')).read()\n+ >>> zope_conf = zope_conf.replace(\'\\\\\', \'/\')\n+ >>> print(zope_conf)\n+ %define INSTANCEHOME .../sample-buildout/parts/instance\n+ ...\n+ debug-exceptions on\n+ ...\n+ <BLANKLINE>\ndiff --git a/src/plone/recipe/zope2instance/wsgischema.xml b/src/plone/recipe/zope2instance/wsgischema.xml\nindex 996394b..da68964 100644\n--- a/src/plone/recipe/zope2instance/wsgischema.xml\n+++ b/src/plone/recipe/zope2instance/wsgischema.xml\n@@ -276,6 +276,22 @@\n <metadefault>off</metadefault>\n </key>\n \n+ <key name="debug-exceptions" datatype="boolean" default="off">\n+ <description>\n+ This switch controls how exceptions are handled. If it is set to\n+ "off" (the default), Zope\'s own exception handling is active.\n+ Exception views or a standard_error_message are used to handle them.\n+\n+ If set to "on", exceptions are not handled by Zope and can propagate\n+ into the WSGI pipeline, where they may be handled by debugging\n+ middleware.\n+\n+ This setting should always be "off" in production. It is useful for\n+ developers and while debugging site issues.\n+ </description>\n+ <metadefault>off</metadefault>\n+ </key>\n+\n <key name="locale" datatype="locale" handler="locale">\n <description>\n Locale name to be used. See your operating system documentation for locale\n'

0 comments on commit 40b44c4

Please sign in to comment.