Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrectly Cached License Translations #5586

@EricSoroos

Description

@EricSoroos

CKAN version

2.8.5->master.

Probably introduced in #4594.

Describe the bug

ckan.models.license:LicenseRegister.load_licenses translates the license text, which is then cached as a classmember in the package class. (as called from ckan.lib.helpers.license_options)

This cache is for the lifetime of uwsgi process, not the request.

The license options should be translated at the helper or the template level, and not cached between multiple requests, unless the cache is keyed to the request language.

Steps to reproduce

On a site with multiple localizations, restart ckan to clear any caches, then request /[lang]/dataset/edit/[name] several times to make sure all wsgi processes have loaded the licenses.

Then visit /en/dataset/edit/[name]` and the licenses will be in the previous localization.

Expected behavior

Each license popup would be rendered in the correct localization.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions