Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#19730 closed New feature (fixed)

Action triggered by django.core.management.base.BaseCommand.can_import_settings is a side effect of i18n locale handling

Reported by: ramiro Owned by: nobody
Component: Core (Management commands) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As discussed in #17379

(from https://code.djangoproject.com/ticket/17379#comment:7):

can_import_settings was supposed to check if settings are available before execution of a command according to documentation (​https://docs.djangoproject.com/en/dev/howto/custom-management-commands/#BaseCommand.can_import_settings). It was doing that only by coincidence… it was doing that by forcing en_us locale via translation module which relies on settings.

This ticket will act as a dependancy of #17379.

Change History (3)

comment:1 Changed 2 years ago by claudep

  • Resolution set to fixed
  • Status changed from new to closed
  • Type changed from Uncategorized to New feature

Fixed in [869c9ba30615cb24fb5786787a2db8655f2f0d2b]:

Fixed #19730 -- Don't validate importability of settings by using i18n in management commands.

They are handled independently now and the latter can be influenced by
the new BaseCommand.leave_locale_alone internal option.

Thanks chrischambers for the report, Claude, lpiatek, neaf and gabooo for
their work on a patch, originally on refs. #17379.

comment:2 follow-up: Changed 2 years ago by claudep

Thanks Ramiro for taking this forward. However I'm not sure about the comment: because many of them create database content that is locale-sensitive (like permissions).

So apart from syncdb, which are the commands who alter the database with potentially localized content?

comment:3 in reply to: ↑ 2 Changed 2 years ago by ramiro

Replying to claudep:

Thanks Ramiro for taking this forward. However I'm not sure about the comment: because many of them create database content that is locale-sensitive (like permissions).

So apart from syncdb, which are the commands who alter the database with potentially localized content?

I will reword that paragraph beacuse I can only think of 'test'. Thanks!

Note: See TracTickets for help on using tickets.
Back to Top