Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented features are broken since cookiecutter 2.2.0 #15

Closed
pbauer opened this issue Feb 1, 2024 · 4 comments
Closed

Documented features are broken since cookiecutter 2.2.0 #15

pbauer opened this issue Feb 1, 2024 · 4 comments

Comments

@pbauer
Copy link
Sponsor Member

pbauer commented Feb 1, 2024

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>
@jensens
Copy link
Sponsor Member

jensens commented Feb 2, 2024

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?

@jensens
Copy link
Sponsor Member

jensens commented Feb 2, 2024

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

@pbauer
Copy link
Sponsor Member Author

pbauer commented Feb 2, 2024

Thanks for working on that!

@jensens
Copy link
Sponsor Member

jensens commented Feb 22, 2024

fixed and released in cookiecutter 2.6.0

@jensens jensens closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants