Merge lp:~michael.nelson/rnr-server/718898-review-unique-prefix into lp:rnr-server

Proposed by Michael Nelson
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 127
Merged at revision: 126
Proposed branch: lp:~michael.nelson/rnr-server/718898-review-unique-prefix
Merge into: lp:rnr-server
Diff against target: 67 lines (+17/-20)
2 files modified
src/reviewsapp/api/urls.py (+17/-19)
src/reviewsapp/utilities.py (+0/-1)
To merge this branch: bzr merge lp:~michael.nelson/rnr-server/718898-review-unique-prefix
Reviewer Review Type Date Requested Status
Ratings and Reviews Developers Pending
Review via email: mp+50718@code.launchpad.net

Commit message

[r=lukasz][bug=718898] Adds a unique prefix to the url for the api review-getter.

Description of the change

Overview
========
Adds a unique prefix to the url for the api review-getter (bug 718898).

I included 'reviews' in the new prefix: '/1.0/reviews/filter/' because the api might support other objects in the future like moderations etc.

Although the old api will continue to work, we should also land https://pastebin.canonical.com/43699/ on rnrclient when landing this branch.

To test: `make;make test`

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/reviewsapp/api/urls.py'
2--- src/reviewsapp/api/urls.py 2011-02-07 17:17:58 +0000
3+++ src/reviewsapp/api/urls.py 2011-02-22 09:51:16 +0000
4@@ -77,34 +77,32 @@
5 url(r'^1.0/review-stats/updates-last-(?P<days>[1,3,7])-days/$',
6 reviews_stats_resource, name='rnr-api-reviews-stats'),
7
8- # vote on the usefulness of a review
9- # POST /1.0/reviews/405/usefulness/False/
10- url(r'^1.0/reviews/(?P<review_id>\d+)/recommendations/$',
11- submit_usefulness_resource, name='rnr-api-recommendations'),
12-
13 # gets the reviews (and ratings) for a given pkg/app
14 # GET /1.0/en/ubuntu/+binary/lucid/1:2.32.0-0ubuntu1/gnome-games;sane/page/1/
15 # GET /1.0/en/ubuntu/+binary/lucid/1:2.32.0-0ubuntu1/2vcard/
16+ url(r'^1.0/reviews/filter/(?P<language>\w+)/(?P<origin>\w+)/'
17+ r'(?P<distroseries>\w+)/(?P<version>[-\w+.:~]+)/'
18+ r'(?P<package_name>[\w%+.;-]+)/$',
19+ show_reviews_resource, name='rnr-api-reviews-for-package'),
20+ url(r'^1.0/reviews/filter/(?P<language>\w+)/(?P<origin>\w+)/'
21+ r'(?P<distroseries>\w+)/(?P<version>[-\w+.:~]+)/'
22+ r'(?P<package_name>[\w%+.;-]+)/page/(?P<page>\d+)/$',
23+ show_reviews_resource, name='rnr-api-reviews-for-package'),
24+ # XXX: michaeln 2011-02-22 bug=718898: These urls should be removed
25+ # a little while after the client has updated to the rnrclient
26+ # matching the above urls.
27 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
28 r'(?P<version>[-\w+.:~]+)/(?P<package_name>[\w%+.;-]+)/$',
29- show_reviews_resource, name='rnr-api-reviews-for-package'),
30+ show_reviews_resource, name='rnr-older-api-reviews-for-package'),
31 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
32 r'(?P<version>[-\w+.:~]+)/(?P<package_name>[\w%+.;-]+)/'
33 r'page/(?P<page>\d+)/$',
34- show_reviews_resource, name='rnr-api-reviews-for-package'),
35+ show_reviews_resource, name='rnr-older-api-reviews-for-package'),
36
37- # achuni 2011-01-27: Support the older api for a short while, until
38- # the client moves over to the newer client
39- url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
40- r'(?P<package_name>[\w%+.;-]+)/$',
41- show_reviews_resource, name='rnr-older-api-reviews-for-package',
42- kwargs={'version': 'any'}),
43- url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
44- r'(?P<package_name>[\w%+.;-]+)/'
45- r'page/(?P<page>\d+)/$',
46- show_reviews_resource, name='rnr-older-api-reviews-for-package',
47- kwargs={'version': 'any'}),
48-
49+ # vote on the usefulness of a review
50+ # POST /1.0/reviews/405/usefulness/False/
51+ url(r'^1.0/reviews/(?P<review_id>\d+)/recommendations/$',
52+ submit_usefulness_resource, name='rnr-api-recommendations'),
53
54 # submits a new review for a given pkg/app
55 # POST /1.0/reviews/
56
57=== modified file 'src/reviewsapp/utilities.py'
58--- src/reviewsapp/utilities.py 2011-02-10 21:40:55 +0000
59+++ src/reviewsapp/utilities.py 2011-02-22 09:51:16 +0000
60@@ -212,7 +212,6 @@
61
62 # achuni 2011-01-27: This removes older api pages from cache, and
63 # can be removed once the client is using the latest api.
64- del url_kwargs['version']
65 package_url = reverse('rnr-older-api-reviews-for-package',
66 kwargs=url_kwargs)
67 key = cache_key_for_url(package_url)

Subscribers

People subscribed via source and target branches