[Django] #22617: Allow to fix translation -> Fix makemessages to not delete debug data and hide errors (and all similar modules using "msgmerge")

24 views
Skip to first unread message

Django

unread,
May 12, 2014, 7:13:37 AM5/12/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Please replace code in make messages to not delete *.po files if error
occured and show messages (fix exception later).

Replace this code:
if errors:
if status != STATUS_OK:
raise CommandError(
"errors happened while running msgmerge\n%s" %
errors)
elif self.verbosity > 0:
self.stdout.write(errors)

With this code (it shows error root cause and save/copy *.po need to solve
this error):

if errors:
if status != STATUS_OK:
self.stdout.write(errors) # bug exception bellow not
shows errors
import shutil
shutil.copyfile(pofile, '%s.debug' % pofile)
raise CommandError(
"errors happened while running msgmerge\n%s" %
errors)
elif self.verbosity > 0:
self.stdout.write(errors)

All modules using command line tools should report errors and not delete
input if error occured.

--
Ticket URL: <https://code.djangoproject.com/ticket/22617>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 12, 2014, 8:32:20 AM5/12/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Does the [https://docs.djangoproject.com/en/1.6/ref/django-admin/#django-
admin-option---keep-pot --keep-pot] option not help?

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:1>

Django

unread,
May 13, 2014, 8:49:46 AM5/13/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by timo):

This [https://github.com/django/django/pull/2648 PR] appears related.

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:2>

Django

unread,
May 13, 2014, 2:10:13 PM5/13/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Cezary.Wagner):

Not known about such option but should not help too much since many bugs
is in code - see my pulls on github.

1. Messages from msgmerge is not presented since bug - exception blocks
print out.
2. --keep-pot is not presented in --help I think so (not checked but never
seen it before - o.k. since it from 1.6).

I think problem is with "blocktrans" on 60% - I gave up now - I was done
very large project more than 1k strings.

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:3>

Django

unread,
May 13, 2014, 2:11:03 PM5/13/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Cezary.Wagner):

Push Request on github is related.

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:4>

Django

unread,
May 13, 2014, 8:45:25 PM5/13/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by timo):

I will let someone more familiar with `makemessages` make a call on
whether or not anything needs to be done here, but for some more context,
I also closed #22615 and #22616 which are related.

I do see `--keep-pot` in the help for `makemessages` on 1.6 (I'm not sure
if that's what you are saying in the above comment).

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:5>

Django

unread,
Jun 28, 2014, 10:27:05 AM6/28/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:6>

Django

unread,
Jun 28, 2014, 4:24:42 PM6/28/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by anonymous):

You not understand this bug really - it is not problem of *.pot bit *.po
file. As far as I remember there is not help if I use --keep-pot.

It not helps :)

Read it again "Messages from msgmerge is not presented since bug -
exception blocks print out." - I will reopen until we will find some
solution - I will not give up now ...

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:7>

Django

unread,
Jun 28, 2014, 4:28:40 PM6/28/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Cezary.Wagner):

It is not solve still "Messages from msgmerge is not presented since bug -
exception blocks print out." is in force!

You need to known where in django template there is error - --keep-pot
allow nothing in this case.

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:8>

Django

unread,
Jun 28, 2014, 4:28:56 PM6/28/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Cezary.Wagner):

* status: closed => new
* resolution: needsinfo =>


--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:9>

Django

unread,
Jul 27, 2014, 7:24:16 AM7/27/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------+--------------------------------------

Reporter: Cezary.Wagner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by areski):

It seems there is some confusion with this ticket, to clarify:

- `keep-pot` option ONLY prevent Django from deleting the temporary .pot
- this patch ensure that we don't delete the original PO file when
`msgmerge` fails.

I haven't be able to test it as I guess it's a bit tricky to make
`msgmerge` fails.
The PR looks good but I would recommend to move 'import shutil' at the top
of the file.

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:10>

Django

unread,
Jul 28, 2014, 3:51:30 PM7/28/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------------+-------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.6
Component: Core (Management | Resolution:
commands) | Triage Stage:
Severity: Normal | Unreviewed
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* component: Uncategorized => Core (Management commands)
* type: Uncategorized => Cleanup/optimization


Old description:

New description:

Please replace code in make messages to not delete *.po files if error

occurred and show messages (fix exception later).

Replace this code:
{{{
if errors:
if status != STATUS_OK:
raise CommandError(
"errors happened while running msgmerge\n%s" %
errors)
elif self.verbosity > 0:
self.stdout.write(errors)
}}}
With this code (it shows error root cause and save/copy *.po need to solve
this error):
{{{
if errors:
if status != STATUS_OK:
self.stdout.write(errors) # bug exception bellow not
shows errors
import shutil
shutil.copyfile(pofile, '%s.debug' % pofile)
raise CommandError(
"errors happened while running msgmerge\n%s" %
errors)
elif self.verbosity > 0:
self.stdout.write(errors)
}}}
All modules using command line tools should report errors and not delete

input if error occurred.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:11>

Django

unread,
Nov 27, 2014, 8:49:48 AM11/27/14
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------------+-------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: Core (Management | Resolution:
commands) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1
* version: 1.6 => master
* stage: Unreviewed => Accepted


Comment:

Let's see if we can get someone to review the patch. Is it feasible to add
tests?

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:12>

Django

unread,
Jan 16, 2015, 3:15:03 AM1/16/15
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------------+-------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by berkerpeksag):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:13>

Django

unread,
Nov 23, 2021, 6:54:20 AM11/23/21
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------------+-------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev

commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Ad Timmering (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:14>

Django

unread,
Nov 24, 2021, 8:29:35 AM11/24/21
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------------+-------------------------------------
Reporter: Cezary.Wagner | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ad Timmering):

@Mariusz: Thanks for cc'ing me. Would be happy to add some tests, however
have been unable to replicate the behavior.

Forcably letting `msgmerge` throw errors (by pausing the `makemessages`
process and messing up the intermediate file on purpose), does for me
(a) give sensible error messages, and
(b) they are actually displayed together with the `CommandError`.
I searched SO etc. for other users with similar issues, but unfortunately
couldn't find an example to build a test around.

I suggest closing as `needsinfo`, pending the original author or someone
else to provide an example of a case where the error message given with
the exception does not provide enough information.


Example of an intentionally broken run:
{{{
(env) awtimmering @ ~/djtest $ ./manage.py makemessages --locale nl
processing locale nl
CommandError: errors happened while running msgmerge
/home/awtimmering/djtest/locale/django.pot:49: keyword "msgid_plasdural"
unknown
/home/awtimmering/djtest/locale/django.pot:45: missing 'msgstr' section
/home/awtimmering/djtest/locale/django.pot:49:16: syntax error
msgmerge: found 3 fatal errors
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:15>

Django

unread,
Nov 24, 2021, 11:15:54 AM11/24/21
to django-...@googlegroups.com
#22617: Allow to fix translation -> Fix makemessages to not delete debug data and
hide errors (and all similar modules using "msgmerge")
-------------------------------------+-------------------------------------
Reporter: Cezary.Wagner | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => needsinfo
* stage: Accepted => Unreviewed


Comment:

Ad, Thanks for checking!

--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:16>

Reply all
Reply to author
Forward
0 new messages