Bug 690687 - Python client should log a message for 301 redirects
Python client should log a message for 301 redirects
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-PythonClient (Show other bugs)
unspecified
Unspecified Unspecified
low Severity unspecified
: ---
: ---
Assigned To: Ding-Yi Chen
Ding-Yi Chen
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-24 23:39 EDT by Sean Flanigan
Modified: 2012-04-23 00:32 EDT (History)
2 users (show)

See Also:
Fixed In Version: v1.3.1-27-gec9cadf
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-23 00:32:47 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 Sean Flanigan 2011-03-24 23:39:45 EDT
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 05:19:05 EDT
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-12 22:55:36 EDT
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-17 23:43:00 EDT
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 03:40:53 EDT
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 00:23:18 EDT
VERIFIED with commit ec9cadf01148f7335e10f98fb0690028b0b0f48e
Comment 6 Sean Flanigan 2011-10-28 04:24:51 EDT
Could you please close this when 1.3.2 is released?
Comment 7 Ding-Yi Chen 2011-10-31 00:50:55 EDT
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.