Bug 727386 - zanata po push does not assume working directory
Summary: zanata po push does not assume working directory
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-PythonClient
Version: 1.2
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-08-02 02:24 UTC by Joshua Wulf
Modified: 2014-10-19 22:59 UTC (History)
5 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:40:02 UTC
Embargoed:


Attachments (Terms of Use)

Description Joshua Wulf 2011-08-02 02:24:54 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.124 Safari/534.30

When I run zanata po push in a directory with a .pot file, the python client complains that it can't find the source folder. 

I have to run 

zanata po push --srcdir .

It should assume .


Reproducible: Always

Steps to Reproduce:
1. Run "zanata po push" in a folder containing zanata.xml and "something.pot"
2. 
3.
Actual Results:  
get an error "error: Can not find source folder, please specify the source folder with '--srcdir' option"

Expected Results:  
It should assume "--srcdir ." by default

Comment 1 James Ni 2011-08-02 02:50:59 UTC
Thanks, actually i assume that user running command in folder containing zanata.xml and a folder named po which contain "something.pot" and "something.po". I agree with you, it should assume "--srcdir ." by default. I will change source code.

Comment 2 Sean Flanigan 2011-08-03 07:44:35 UTC
Actually, to keeps backwards compatibility, we need to keep --srcdir's default as "./po" in 'zanata po push'.

However, we should change the default for --srcdir in the new generic command 'zanata push' to be ".", ie current directory.  The same goes for --transdir and for the new command 'zanata pull'.

Comment 3 Joshua Wulf 2011-08-03 09:11:15 UTC
Another alternative:

Keep the current behaviour, add searching the current working directory if it is not found in a ./po directory.

So it would behave the as expected for existing users who are used to the previous behaviour, and would also work for people who put the zanata.xml file in the same directory as the .pot file.

That would be forwards-compatible as well, because the new zanata push could replicate that search pattern.

Comment 4 Sean Flanigan 2011-08-04 05:37:41 UTC
I think it would help a lot if the helptext mentioned the default value for each option, especially for --srcdir.  If we do that, describing even a simple search algorithm becomes a pain.  (And even simple search algorithms add a little complexity, and need testing.)

Also it wouldn't really make sense for a generic push/pull to look at a directory named "po", since it's supposed to be generic.  Eventually it will be pushing and pulling other file formats, not just gettext.

We do plan to deprecate the old publican/po push/pull before much longer.

Comment 5 James Ni 2011-08-16 10:06:50 UTC
I have modified source code for srcdir processing in commit 4ea63b:
1)First, checking the '.', if finding pot files, then srcdir point to '.'.
2)Then, if can not find pot files under current path, check the pot/po folder under current path, if finding pot files, then srcdir point to pot/po folder
3)At last, if can not find pot files in both case, give a error to user that can not find the source files. 

For --transdir, the default value is '.' for the command 'zanata pull'. 

For 'zanata po push', i assume transdir default value is equal to srcdir value, because normally they are in the same folder for the software project. For 'zanata publican push', i set transdir default value to '.'

I have test these on my local machine, it seems working fine.

Comment 6 Sean Flanigan 2012-02-17 08:12:44 UTC
James, what you've done is fine for "zanata po push", but the generic "zanata push" should look only in $srcdir, NOT in $srcdir/po.

Comment 7 Sean Flanigan 2012-02-17 08:14:19 UTC
The reason for this is to be symmetrical with "zanata pull", which defaults to current directory when writing.

Thus, "zanata push" will push from "." by default, and "zanata pull" will pull to "." by default.

Comment 8 Mario Santagiuliana 2012-02-22 12:37:12 UTC
I am trying to push po file to publican-ug on zanata web site.
I copy Italian config xml file in my directory. I done:

$ zanata pull --lang it --project-type podir

I copied my translated file and trying to push the translation to zanata website I have got every times:
error: Can not find source folder, please specify the source folder with '--srcdir' or 'dir' option

exactly explained in the first comment.

Version:
$ rpm -q zanata-python-client
zanata-python-client-1.3.3-1.fc16.noarch

Could you provides an rpm update? Thank you.

Comment 9 Sean Flanigan 2012-02-23 00:34:39 UTC
Hi Mario,

This bug is about the "po push" command, which is deprecated in favour of the generic "push" command.  http://www.redhat.com/mailman/listinfo/zanata-users is probably the best place to discuss this, but...

Unfortunately, the Zanata server currently doesn't allow translators to push PO files from the command line, only project maintainers (and only together with the POT files).  

The current command-line push feature is designed to allow project maintainers to push the source language (English) and import any *pre-existing* translations.  New translation work should be done in Zanata's web editor.

Comment 10 Mario Santagiuliana 2012-02-23 07:24:49 UTC
Thanks Sean for your reply. I hope you can upgrade the zanata server. Sometime for translators are easiest to translate locally and then push their po files...

Thank you!

Comment 11 James Ni 2012-02-24 03:36:36 UTC
Hi

I have modified source code base on Sean's comment, "zanata push" will push from "." by default, and "zanata pull" will pull to "." by default. This change is included in version 1.3.4 of zanata-python-client. 

Please use "yum install zanata-python-client --enablerepo=updates-testing" to install and test the new version

Comment 12 Ding-Yi Chen 2012-02-28 06:28:09 UTC
VERIFIED with 1.3.4


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