Opened 8 years ago

Closed 7 years ago

#3955 closed (fixed)

compile-messages.py could use LOCALE_PATHS from settings.py

Reported by: Olivier Ricou <ricou@…> Owned by: semenov
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Why compile-messages.py does not use the LOCALE_PATHS variable defined in settings.py
to define the basedir directory ? Now we are restricted to locale and conf/locale.

Attachments (4)

compile-messages-use-settings-module.diff (3.0 KB) - added by semenov 8 years ago.
bugfix_for_r6349.diff (1.0 KB) - added by Wang Chun <wangchun@…> 8 years ago.
bugfix for r6349
bugfix_for_r6349.2.diff (1.1 KB) - added by Wang Chun <wangchun@…> 8 years ago.
bugfix for r6349
bugfix-no-locale-paths-in-settings.diff (1.1 KB) - added by semenov 8 years ago.
A bugfix to a patch by Wang Chun, uses hasattr() instead of try/except

Download all attachments as: .zip

Change History (14)

comment:1 Changed 8 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Good point. This would be a reasonable fix to make: have compile-messages.py also compile PO files under the directories in LOCALE_PATHS.

comment:2 Changed 8 years ago by mtredinnick

  • Component changed from Translations to Internationalization

comment:3 Changed 8 years ago by semenov

  • Owner changed from nobody to semenov
  • Status changed from new to assigned

comment:4 Changed 8 years ago by semenov

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

Here it goes.

Changed 8 years ago by semenov

comment:5 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [6349]) Fixed #3955 -- Added the ability to traverse LOCALE_PATHS when compiling PO files. Thanks, semenov.

Changed 8 years ago by Wang Chun <wangchun@…>

bugfix for r6349

comment:6 Changed 8 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Ready for checkin to Unreviewed

I reopened this ticket because of a bug in r6349.

I have runtime error with compile-messages.py:

Traceback (most recent call last):
  File "/home/wangchun/src/django/django/bin/compile-messages.py", line 64, in <module>
    main()
  File "/home/wangchun/src/django/django/bin/compile-messages.py", line 61, in main
    compile_messages(options.locale)
  File "/home/wangchun/src/django/django/bin/compile-messages.py", line 17, in compile_messages
    basedirs += settings.LOCALE_PATHS
  File "/home/wangchun/src/cityweekend/lib/django/django/conf/__init__.py", line 32, in __getattr__
    return getattr(self._target, name)
AttributeError: 'Settings' object has no attribute 'LOCALE_PATHS'

I have attached a patch for this.

Changed 8 years ago by Wang Chun <wangchun@…>

bugfix for r6349

comment:7 Changed 8 years ago by Wang Chun <wangchun@…>

sorry, stupid mistake...

plz use bugfix_for_r6349.2.diff instead.

comment:8 Changed 8 years ago by semenov

Agreed. However, they tend to use hasattr() approach instead of try/except in Django code, so the patch should look a bit different.

Changed 8 years ago by semenov

A bugfix to a patch by Wang Chun, uses hasattr() instead of try/except

comment:9 Changed 8 years ago by semenov

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:10 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [6447]) Fixed #3955 -- Handled the case when there is no LOCALE_PATHS setting from [6349]. Thanks, Wang Chun and semenov.

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