plone/cookiecutter-zope-instance

Documented features are broken since cookiecutter 2.2.0

Closed this issue · 4 comments

Not sure what else is broken but at least setting environment does not work if a version later than cookiecutter==2.1.1 is used.

To reproduce:
Use a simple instance.yaml:

default_context:
    initial_user_name: 'admin'
    initial_user_password: 'admin'
    debug_mode: 'True'
    verbose_security: 'True'

    environment: {
      zope_i18n_compile_mo_files: true,
      CHAMELEON_CACHE: '{{ cookiecutter.location_clienthome }}/cache',
      PTS_LANGUAGES: 'de',
      zope_i18n_allowed_languages: 'de',
    }

    db_storage: direct

After ./bin/pip install cookiecutter==2.5.0 and ./bin/cookiecutter -f --no-input --config-file instance.yaml gh:plone/cookiecutter-zope-instance I get a instance/etc/zope.conf which has the debug-mode but is missing the environment settings:

# This file was generated by "cookiecutter-zope-instance"
%define INSTANCEHOME /Users/pbauer/workspace/bfs/dokpool/backend/instance
instancehome $INSTANCEHOME

%define CLIENTHOME /Users/pbauer/workspace/bfs/dokpool/backend/instance/var
clienthome $CLIENTHOME

debug-mode on
security-policy-implementation PYTHON
verbose-security on

default-zpublisher-encoding utf-8
<environment>
    CHAMELEON_CACHE instance/var/cache
    zope_i18n_compile_mo_files True

</environment>
<dos_protection>
    form-memory-limit 1MB
    form-disk-limit 1GB
    form-memfile-limit 4KB
</dos_protection>

# Database
<zodb_db main>
    mount-point /
    cache-size 30000
    # Blob-enabled FileStorage database
    <filestorage>
        path /Users/pbauer/workspace/bfs/dokpool/backend/instance/var/filestorage/Data.fs
        blob-dir /Users/pbauer/workspace/bfs/dokpool/backend/instance/var/blobs
        pack-keep-old true
    </filestorage>
</zodb_db>

After ./bin/pip install cookiecutter==2.1.1 and ./bin/cookiecutter -f --no-input --config-file instance.yaml gh:plone/cookiecutter-zope-instance I get the following instance/etc/zope.conf which is fine:

# This file was generated by "cookiecutter-zope-instance"
%define INSTANCEHOME /Users/pbauer/workspace/bfs/dokpool/backend/instance
instancehome $INSTANCEHOME

%define CLIENTHOME /Users/pbauer/workspace/bfs/dokpool/backend/instance/var
clienthome $CLIENTHOME

debug-mode on
security-policy-implementation PYTHON
verbose-security on

default-zpublisher-encoding utf-8
<environment>
    CHAMELEON_CACHE instance/var/cache
    PTS_LANGUAGES de
    zope_i18n_allowed_languages de
    zope_i18n_compile_mo_files True

</environment>
<dos_protection>
    form-memory-limit 1MB
    form-disk-limit 1GB
    form-memfile-limit 4KB
</dos_protection>

# Database
<zodb_db main>
    mount-point /
    cache-size 30000
    # Blob-enabled FileStorage database
    <filestorage>
        path /Users/pbauer/workspace/bfs/dokpool/backend/instance/var/filestorage/Data.fs
        blob-dir /Users/pbauer/workspace/bfs/dokpool/backend/instance/var/blobs
        pack-keep-old true
    </filestorage>
</zodb_db>

This is still a problem with 2.5.0 as well.
So I do not know why you use the JSON syntax in YAML, but even this should work.
As of cookiecutter 2.2.0 the repetition of the default should not be needed too.

So, I tried with

    # ...
    environment:
        PTS_LANGUAGES: 'de'
        zope_i18n_allowed_languages: 'de'
    # ...

with the same result:

<environment>
    CHAMELEON_CACHE instance/var/cache
    zope_i18n_compile_mo_files true
</environment>

cc @ericof do you have any clue?

It is a regression in cookiecutter, see cookiecutter/cookiecutter#2009

Thanks for working on that!

fixed and released in cookiecutter 2.6.0