Bug 753719 - No proper error message when specify unsupported project type
No proper error message when specify unsupported project type
Status: CLOSED NEXTRELEASE
Product: Zanata
Classification: Community
Component: Component-PythonClient (Show other bugs)
1.4.3-SNAPSHOT
Unspecified Linux
unspecified Severity medium
: ---
: ---
Assigned To: James Ni
Ding-Yi Chen
:
Depends On:
Blocks: zanata-1.5.0
  Show dependency treegraph
 
Reported: 2011-11-14 04:47 EST by Joshua Wulf
Modified: 2014-10-19 18:59 EDT (History)
3 users (show)

See Also:
Fixed In Version: 1.3.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-05 02:41:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Joshua Wulf 2011-11-14 04:47:26 EST
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2

[jwulf@gaura Zanata_Topic_Bucket]$ zanata push --project-type=po --username=admin --apikey=XXXX
Loading zanata project config from: /tmp/scratch/Zanata/Zanata_Topic_Bucket/zanata.xml
Loading zanata user config from: /home/jwulf/.config/zanata.ini
zanata server: http://zanata-endeavour.lab.eng.bne.redhat.com:8080
zanata python client version: 1.3.1, zanata server API version: 1.4.3-SNAPSHOT
Project: Zanata-topics
Version: 1
Username: admin
Source language: en-US
Copy previous translations:True
Traceback (most recent call last):
  File "/usr/bin/zanata", line 25, in <module>
    zanata.run()
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 1223, in run
    program_name=os.path.split(sys.argv[0])[1],
  File "/usr/lib/python2.7/site-packages/zanataclient/command.py", line 325, in handle_program
    command(command_options, args)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 1047, in push
    tmlfolder = process_srcdir(command_options, command_type, project_config, default_folder)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 467, in process_srcdir
    tmlfolder = check_pofile(tmlfolder, project_type)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 447, in check_pofile
    sub_folder = os.path.join(tmlfolder, folder_type)
UnboundLocalError: local variable 'folder_type' referenced before assignment


Reproducible: Always
Comment 1 Joshua Wulf 2011-11-14 04:49:28 EST
po push gives a different result (error):


[jwulf@gaura Zanata_Topic_Bucket]$ zanata po push --username=admin --apikey=XXXX --srcdir pot/
Loading zanata project config from: /tmp/scratch/Zanata/Zanata_Topic_Bucket/zanata.xml
Loading zanata user config from: /home/jwulf/.config/zanata.ini
zanata server: http://zanata-endeavour.lab.eng.bne.redhat.com:8080
zanata python client version: 1.3.1, zanata server API version: 1.4.3-SNAPSHOT
Project: Zanata-topics
Version: 1
Username: admin
Source language: en-US
Copy previous translations:True
PO directory (originals):pot/
Importing source documents only

Pushing the content of pot/Zanata_Topic_Bucket.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/Chapter-All_the_Zanata_topics.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/361.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/368.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/371.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/504.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/370.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/503.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/362.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/369.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/502.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/topics/366.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/Preface.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/Author_Group.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/Revision_History.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/Book_Info.pot to server:
error: Unexpected Status, failed to push

Pushing the content of pot/Errors.pot to server:
error: Unexpected Status, failed to push
Comment 2 Joshua Wulf 2011-11-14 04:55:28 EST
Same results with 1.3.2:

zanata python client version: 1.3.2, zanata server API version: 1.4.3-SNAPSHOT
Comment 3 James Ni 2011-11-14 21:09:27 EST
Hi Joshua,

Thanks, there are two issues about the python client: 
1) If the server doesn't enable the en-US, the python client will display an error, but i think the python client should give more precise message to user, i will try to fix it.

2) zanata push command use --project-type=gettext, not --project-type=po, I think that's the reason caused zanata push command failed, i will try to modify the code to make sure that python client give a error message if the project-type is not correct.

Best Regards
Comment 4 James Ni 2011-11-17 03:24:37 EST
Hi 

I have modified the code to fix this issue, please try commit 74e749a on git-hub to test this issue.
Comment 5 Ding-Yi Chen 2012-02-22 23:22:51 EST
VERIFIED with 1.3.4

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