Bug 768877 - python client breaks PO file when no translation found
Summary: python client breaks PO file when no translation found
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-PythonClient
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: James Ni
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On: 768875
Blocks: zanata-1.5.0
TreeView+ depends on / blocked
 
Reported: 2011-12-19 09:08 UTC by Akira TAGOH
Modified: 2012-04-05 06:33 UTC (History)
2 users (show)

Fixed In Version: zanata python client version: 1.3.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-05 06:33:35 UTC
Embargoed:


Attachments (Terms of Use)
zanata.xml for ibus-chewing (2.26 KB, text/xml)
2012-02-23 06:07 UTC, Ding-Yi Chen
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 754870 0 high CLOSED Maven client should generate skeletons for empty files 2021-02-22 00:41:40 UTC

Internal Links: 754870

Description Akira TAGOH 2011-12-19 09:08:54 UTC
Description of problem:
As per Bug#768875, even though zanata client says "no translation", it's going to write PO file with the broken contents. actually it was something what the client was success to update last time.

Version-Release number of selected component (if applicable):
zanata-python-client-1.3.1-1.fc15.noarch

How reproducible:
always

Steps to Reproduce:
1.see the step in Bug#768875.
2.
3.
  
Actual results:
Retrieving zh_CN translation from server:
There is no zh_CN translation for imsettings
Writing po file to /home/tagoh/work/repo/imsettings/po/zh_CN.po

and more.

Expected results:
that should stop writing if no translation found.

Additional info:

Comment 1 David Mason 2011-12-21 05:45:04 UTC
*** Bug 768875 has been marked as a duplicate of this bug. ***

Comment 2 James Ni 2012-01-05 03:07:32 UTC
Hi, 

I have make a commit to git-hub for zanata-python-client to fix this issue, if there is no translation, or the locale is not enabled on the server, the client will stop writing. Please check out the latest code for testing.

'map-from' actually works, but the client only display the locale name using on the client side, doesn't output the process of mapping. So do you think we should output more detail info for mapping process? like:

Mapping zh_CN to zh-Hans-CN
Retrieving zh-Hans-CN translation from server:
.....

or 

Can not find mapping in zanata.xml, using zh_CN directly.   
Retrieving zh_CN translation from server:
.....

Maybe it is more clear for the user? 

Best Regards

Comment 3 James Ni 2012-02-09 02:36:30 UTC
Hi, 

I add a option named --noskeleton to python client. If users doesn't want to generate empty po files when no translation found, they can enable this option. The python client will generate skeletons files for empty po files by default, since some publican users need this feature. Please take reference: Bug 754870
https://bugzilla.redhat.com/show_bug.cgi?id=768877
Also, the python client need to make consist with Maven client.

Comment 4 James Ni 2012-02-09 02:40:51 UTC
Hi, 

I add a option named --noskeleton to python client in commit 47bb369bbb https://github.com/zanata/zanata-python-client/commit/47bb369bbbfd0d243050b6b98e98bd3690b9ad0c. 
If users doesn't want to generate empty po files when no translation found, they can enable this option. By default, the python client will generate skeletons files when no translations found, since some publican users need this feature. Please take reference: "Bug 754870 Maven client should generate skeletons for empty files" https://bugzilla.redhat.com/show_bug.cgi?id=768877
Also, the python client need to make consist with Maven client. 

Best Regards

Comment 5 Ding-Yi Chen 2012-02-23 05:09:02 UTC
Version 1.3.4 does contain this function, yet zanata --help pull does not show such option.

Please add a description of this --noskeletion function.

Another thing I need to mention is when I run following command:

zanata --noskeletion --project-type=gettext

Following error occurs if zanata.xml does not contain <project-type>gettext</project-type>

error: 'NoneType' object has no attribute 'makefile'

This does not occurs without --noskeletion, nor does it happen for 
zanata po pull.

Thus this bug is reassigned.

Comment 6 Ding-Yi Chen 2012-02-23 06:07:40 UTC
Created attachment 565193 [details]
zanata.xml for ibus-chewing

Comment 7 Ding-Yi Chen 2012-02-23 06:09:51 UTC
That error: 'NoneType' object has no attribute 'makefile' 
is actually happen when pull from ibus-chewing, translate.zanata.org.

In comment 5 I make 2 error:
1. the command is "zanata --noskeleton --project-type=gettext"
2. "zanata po pull" also trigger this problem

Comment 8 Ding-Yi Chen 2012-02-23 07:28:00 UTC
Mmm, seems the error: 'NoneType' object has no attribute 'makefile'
is caused by python-httplib2. (see http://code.google.com/p/httplib2/issues/detail?id=62)

Comment 9 James Ni 2012-03-01 03:19:08 UTC
Hi Ding

Thanks a lot for your info. I have tried to install version 0.7.2 of python-httplib2, and try with version 1.3.4 of zanata-python-client, found this issue is fixed. There is no need to modify the zanata-python-client. 

The reason of this issue is "server refused the connection", so if you want to verify this issue, you can just simplify change the URL in zanata.xml to <url>http://localhost:8080/zanata</url> and stop running local instance of zanata, you will see the error message with python-httplib2 < 0.7.1: 
error: 'NoneType' object has no attribute 'makefile'
with 0.7.2. the error message is changed to:
error: [Errno 111] Connection refused. 

If you want to verify this issue on F15, F16, please download 0.7.2 directly from:
http://httplib2.googlecode.com/files/httplib2-0.7.2.tar.gz
unzip and run 'python setup.py install'.

Comment 10 Ding-Yi Chen 2012-03-19 06:47:09 UTC
James,

The default behaviour, (without --noskeleton), is now consist with maven client. which is good.

However, there is no option if user do need skeleton files.

I'll verified this for now, but note that you might need to provide such option in future.

VERIFIED with 1.3.4-7-gab64


Note You need to log in before you can comment on or make changes to this bug.