From 8b15c68694c498e27da22a3efbe8f525ceb74299 Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Tue, 12 Jan 2021 15:33:10 +0100 Subject: [PATCH 1/2] Restored ability to use own explicit version of zodb-temporary-storage. You used to be able to set `zodb-temporary-storage = ` and have this config in the `site.zcml`. Most important use of this was to let this empty, effectively disabling the temporary storage. PR https://github.com/plone/plone.recipe.zope2instance/pull/93 changed this so you could do this in a more natural way. by setting `zodb-temporary-storage = false`. But this (accidentally) removed the possibility for setting an explicit own version of the temporary storage snippet, and meant the only options now were false or true. The documentation still mentions: If given Zope's default temporary storage definition will be replaced by the lines of this parameter. --- news/93.bugfix | 2 ++ src/plone/recipe/zope2instance/recipe.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 news/93.bugfix diff --git a/news/93.bugfix b/news/93.bugfix new file mode 100644 index 00000000..45d8d6b0 --- /dev/null +++ b/news/93.bugfix @@ -0,0 +1,2 @@ +Restored ability to use own explicit version of zodb-temporary-storage. +[maurits] diff --git a/src/plone/recipe/zope2instance/recipe.py b/src/plone/recipe/zope2instance/recipe.py index 035318f0..2cda67c1 100644 --- a/src/plone/recipe/zope2instance/recipe.py +++ b/src/plone/recipe/zope2instance/recipe.py @@ -661,8 +661,10 @@ def is_rs_option(name): zodb_tmp_storage = options.get('zodb-temporary-storage', 'on') if zodb_tmp_storage.lower() in ('off', 'false', '0'): + # no temporary-storage snippet zodb_tmp_storage = '' - else: + elif zodb_tmp_storage.lower() in ('on', 'true', '1'): + # use default temporary-storage snippet zodb_tmp_storage = zodb_temporary_storage_template template = wsgi_conf_template if self.wsgi else zope_conf_template From 8179b108c6a8a3bc3ef7f4fedd5fecf7ea331808 Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Wed, 13 Jan 2021 11:47:11 +0100 Subject: [PATCH 2/2] Added more tests for zodb-temporary-storage option. They fail without the fix from the previous commit. --- .../tests/zope2instance_tempstorage_off.rst | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/plone/recipe/zope2instance/tests/zope2instance_tempstorage_off.rst b/src/plone/recipe/zope2instance/tests/zope2instance_tempstorage_off.rst index 9ca4b7d6..c4fda211 100644 --- a/src/plone/recipe/zope2instance/tests/zope2instance_tempstorage_off.rst +++ b/src/plone/recipe/zope2instance/tests/zope2instance_tempstorage_off.rst @@ -77,3 +77,105 @@ The generated configuration has no temporary storage section anymore: python-check-interval 1000 +Leaving the option empty should have the same result, +as this was previously the way to disable it:: + + >>> write('buildout.cfg', + ... ''' + ... [buildout] + ... parts = instance + ... find-links = %(sample_buildout)s/eggs + ... + ... [instance] + ... recipe = plone.recipe.zope2instance + ... eggs = + ... user = me:me + ... zodb-temporary-storage = + ... ''' % options) + +Let's run it:: + + >>> output = system(join('bin', 'buildout')) + >>> "Installing instance" in output + True + + >>> WINDOWS or "Generated script" in output + True + + >>> WINDOWS or "Generated interpreter" in output + True + +The generated configuration should be the same as from the previous run. + + >>> instance = os.path.join(sample_buildout, 'parts', 'instance') + >>> with open(os.path.join(instance, 'etc', 'zope.conf')) as fd: + ... zope_conf2 = fd.read() + >>> zope_conf2 = zope_conf2.replace('\\', '/') + >>> zope_conf == zope_conf2 + True + + +Explicit ZODB temporary storage +=============================== + +You can also explicitly set an own ZODB temporary storage definition: + + >>> write('buildout.cfg', + ... ''' + ... [buildout] + ... parts = instance + ... find-links = %(sample_buildout)s/eggs + ... + ... [instance] + ... recipe = plone.recipe.zope2instance + ... eggs = + ... user = me:me + ... zodb-temporary-storage = + ... ''' % options) + +Let's run it:: + + >>> output = system(join('bin', 'buildout')) + >>> "Installing instance" in output + True + + >>> WINDOWS or "Generated script" in output + True + + >>> WINDOWS or "Generated interpreter" in output + True + +The generated configuration has our explicit temporary storage section: + + >>> instance = os.path.join(sample_buildout, 'parts', 'instance') + >>> with open(os.path.join(instance, 'etc', 'zope.conf')) as fd: + ... zope_conf = fd.read() + >>> zope_conf = zope_conf.replace('\\', '/') + >>> print(zope_conf) + %define INSTANCEHOME .../sample-buildout/parts/instance + instancehome $INSTANCEHOME + %define CLIENTHOME .../sample-buildout/var/instance + clienthome $CLIENTHOME + debug-mode off + security-policy-implementation C + verbose-security off + default-zpublisher-encoding utf-8 + + CHAMELEON_CACHE .../var/cache + + + # Main database + cache-size 30000 + # Blob-enabled FileStorage database + + blob-dir .../sample-buildout/var/blobstorage + # FileStorage database + + path .../sample-buildout/var/filestorage/Data.fs + + + mount-point / + + + python-check-interval 1000 +