RatingsAndReviewsAPI.get_review() with appname returns a 404

Bug #690702 reported by Michael Vogt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ratings and Reviews server
Fix Released
Undecided
Unassigned

Bug Description

This tiny test app returns a 404 for the last call (when a appname is included in the request):

    rnr = RatingsAndReviewsAPI()
    print rnr.server_status()
    for stat in rnr.review_stats():
        print stat.package_name, stat.ratings_average, stat.ratings_total
    print rnr.get_reviews(language="en",origin="ubuntu",distroseries="natty",
                          packagename="2vcard")
    # FIXME: not working yet, why?
    print rnr.get_reviews(language="en",origin="ubuntu",distroseries="lucid",
                          packagename="p7zip-full",
                          appname="7zip")

Revision history for this message
Michael Nelson (michael.nelson) wrote :

This bug will not happen with r14 of rnr-client, it's just that the change that landed with r15 rnrclient requires a change to the appserver also. You can verify this by:

1) update your rnrserver locally with `bin/buildout` (this pulls the latest rnrclient - now r15)
2) `make test` - note the two errors.
3) `bzr revert -r 14 parts/required-isd-branches/rnrclient/`
4) `make test` - all tests pass.

Michael Vogt (mvo)
Changed in rnr-server:
status: New → Invalid
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks Michael, I'm not really sure this is causing the problem (but I reverted it nevertheless). I looked at the urls.py code for the api and it appears that there is no appname in there (anymore?). The tests seem to not submit a review with a appname (they do with a pkgname).

Changed in rnr-server:
status: Invalid → New
Revision history for this message
Michael Vogt (mvo) wrote :

When I run:

$ w3m -dump http://184.82.116.62/reviews/api/1.0/en/ubuntu/natty/unace/ACE/
Page not found (404)
Request Method: GET
 Request URL: http://184.82.116.62/reviews/api/1.0/en/ubuntu/natty/unace/ACE/

Using the URLconf defined in urls, Django tried these URL patterns, in this
order:
...
 8. ^reviews/ ^api/ ^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\
    w+)/(?P<pkgname>[\w%-]+)/$
 9. ^reviews/ ^api/ ^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\
    w+)/(?P<pkgname>[\w%-]+)/page/(?P<page>\d+)/$
...

But:
w3m -dump http://184.82.116.62/reviews/api/1.0/en/ubuntu/natty/unace/
[]

The review is there:
$ w3m -dump http://184.82.116.62/reviews/api/1.0/review-stats
...
    {
        "ratings_total": 1,
        "ratings_average": "4.00",
        "app_name": "ACE",
        "package_name": "unace"
    },
...

Revision history for this message
Michael Vogt (mvo) wrote :

I should add that the rnr-client uses %2F to escape the "/" in the appname, but that gives a 404 as well:
$ w3m -dump 'http://184.82.116.62/reviews/api/1.0/en/ubuntu/natty/unace%2FACE'
Not Found

The requested URL /reviews/api/1.0/en/ubuntu/natty/unace/ACE was not found on
this server.

(both with w3m and rnrclient.py). I verified with wireshark that the %2F is really send and that nothing
unescapes it again before it hits the wire. But on the recieving side it may get unescapted from one
of the frontend servers ?

Revision history for this message
Michael Vogt (mvo) wrote :

A fix for this (that changes the seperator char from %2F to ";") has landed in trunk

Changed in rnr-server:
status: New → Fix Committed
Changed in rnr-server:
milestone: none → 11.01
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.