This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 768877 - python client breaks PO file when no translation found
python client breaks PO file when no translation found
Status: CLOSED NEXTRELEASE
Product: Zanata
Classification: Community
Component: Component-PythonClient (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: James Ni
Ding-Yi Chen
:
Depends On: 768875
Blocks: zanata-1.5.0
  Show dependency treegraph
 
Reported: 2011-12-19 04:08 EST by Akira TAGOH
Modified: 2012-04-05 02:33 EDT (History)
2 users (show)

See Also:
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 02:33:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Akira TAGOH 2011-12-19 04:08:54 EST
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 00:45:04 EST
*** Bug 768875 has been marked as a duplicate of this bug. ***
Comment 2 James Ni 2012-01-04 22:07:32 EST
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-08 21:36:30 EST
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-08 21:40:51 EST
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 00:09:02 EST
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 01:07:40 EST
Created attachment 565193 [details]
zanata.xml for ibus-chewing
Comment 7 Ding-Yi Chen 2012-02-23 01:09:51 EST
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 02:28:00 EST
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-02-29 22:19:08 EST
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 02:47:09 EDT
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.