Bug 753719 - No proper error message when specify unsupported project type
Summary: No proper error message when specify unsupported project type
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-PythonClient
Version: 1.4.3-SNAPSHOT
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: James Ni
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks: zanata-1.5.0
TreeView+ depends on / blocked
 
Reported: 2011-11-14 09:47 UTC by Joshua Wulf
Modified: 2014-10-19 22:59 UTC (History)
3 users (show)

Fixed In Version: 1.3.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-05 06:41:54 UTC
Embargoed:


Attachments (Terms of Use)

Description Joshua Wulf 2011-11-14 09:47:26 UTC
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 09:49:28 UTC
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 09:55:28 UTC
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-15 02:09:27 UTC
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 08:24:37 UTC
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-23 04:22:51 UTC
VERIFIED with 1.3.4


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