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.
* 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>
Comment (by timo):
This [https://github.com/django/django/pull/2648 PR] appears related.
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:2>
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>
Comment (by Cezary.Wagner):
Push Request on github is related.
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:4>
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>
* status: new => closed
* resolution: => needsinfo
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:6>
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>
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>
* status: closed => new
* resolution: needsinfo =>
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:9>
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>
* 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>
* 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>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:13>
* cc: Ad Timmering (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:14>
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>
* status: new => closed
* resolution: => needsinfo
* stage: Accepted => Unreviewed
Comment:
Ad, Thanks for checking!
--
Ticket URL: <https://code.djangoproject.com/ticket/22617#comment:16>