Bug 690687 - Python client should log a message for 301 redirects
Summary: Python client should log a message for 301 redirects
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-PythonClient
Version: unspecified
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
: ---
Assignee: Ding-Yi Chen
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-25 03:39 UTC by Sean Flanigan
Modified: 2012-04-23 04:32 UTC (History)
2 users (show)

Fixed In Version: v1.3.1-27-gec9cadf
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-23 04:32:47 UTC
Embargoed:


Attachments (Terms of Use)

Description Sean Flanigan 2011-03-25 03:39:45 UTC
At present, the Python client handles 301 and 302 redirects by automatically redirecting (probably thanks to httplib2).

According to wikipedia:
"If the 301 status code is received in response to a request of any type other than GET or HEAD, the client must ask the user before redirecting."

In the interests of automation, I'm happy for the client to redirect automatically (especially if --force is set), but it should at least log a warning.

Comment 1 James Ni 2011-04-11 09:19:05 UTC
I have add a warning for 301 and 302 redirecting, the changes are in commit  72b717e41c9fce54be3a of devel branch of zanata python client on github.

Comment 2 James Ni 2011-04-13 02:55:36 UTC
I modify the warning and add the information of the new URL of redirecting, also I add a check for response.previous, if it is none, we don't need to log a warning. The changes are in commit 7be3cde2cf756703fc49 of devel branch of zanata python client on github.

Comment 3 Ding-Yi Chen 2011-10-18 03:43:00 UTC
Version create works, but push produced "error: Unexpected Status, failed to push"


Test case:

ibus-chewing to fedora.zanata.org (which should be redirected to translate.zanata.org)

Step:
1. git-clone git://github.com/definite/ibus-chewing.git
2. cd ibus-chewing/po
3. xgettext --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 -s --package-name=ibus-chewing --package-version=master -o ibus-chewing.pot ../src/*.c ../src/*.gob
4. edit zanata.xml as:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
    <url>https://fedora.zanata.org/zanata/</url>
    <project>ibus-chewing</project>
    <project-version>1.3.10</project-version>
    <locales>
        <locale map-from="zh_TW">zh-Hant-TW</locale>
        <locale map-from="zh_CN">zh-Hans-CN</locale>
    </locales>
</config>
5. zanata push --project-type=gettext --username=<user> --apikey=<key> --url=https://fedora.zanata.org/zanata/

Expected:
Pushing with redirection warning.

Actual:
Pushing the content of ibus-chewing.pot to server:
warning: encountered msgctxt; not currently supported
warning: encountered msgctxt; not currently supported
warning: encountered msgctxt; not currently supported
error: Unexpected Status, failed to push

Comment 4 James Ni 2011-10-19 07:40:53 UTC
Hi Ding,

I have commit a change 654368b to git-hub to fix this issue, basically i add a handler for status code is 301 when pushing pot file and po file. Please use latest code to verify it, thanks.

Comment 5 Ding-Yi Chen 2011-10-21 04:23:18 UTC
VERIFIED with commit ec9cadf01148f7335e10f98fb0690028b0b0f48e

Comment 6 Sean Flanigan 2011-10-28 08:24:51 UTC
Could you please close this when 1.3.2 is released?

Comment 7 Ding-Yi Chen 2011-10-31 04:50:55 UTC
Sure, I will make sure this bug does not reappear then close it.


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