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
=== modified file 'src/reviewsapp/api/urls.py'
--- src/reviewsapp/api/urls.py 2011-02-07 17:17:58 +0000
+++ src/reviewsapp/api/urls.py 2011-02-22 09:51:16 +0000
@@ -77,34 +77,32 @@
77 url(r'^1.0/review-stats/updates-last-(?P<days>[1,3,7])-days/$',77 url(r'^1.0/review-stats/updates-last-(?P<days>[1,3,7])-days/$',
78 reviews_stats_resource, name='rnr-api-reviews-stats'),78 reviews_stats_resource, name='rnr-api-reviews-stats'),
7979
80 # vote on the usefulness of a review
81 # POST /1.0/reviews/405/usefulness/False/
82 url(r'^1.0/reviews/(?P<review_id>\d+)/recommendations/$',
83 submit_usefulness_resource, name='rnr-api-recommendations'),
84
85 # gets the reviews (and ratings) for a given pkg/app80 # gets the reviews (and ratings) for a given pkg/app
86 # GET /1.0/en/ubuntu/+binary/lucid/1:2.32.0-0ubuntu1/gnome-games;sane/page/1/81 # GET /1.0/en/ubuntu/+binary/lucid/1:2.32.0-0ubuntu1/gnome-games;sane/page/1/
87 # GET /1.0/en/ubuntu/+binary/lucid/1:2.32.0-0ubuntu1/2vcard/82 # GET /1.0/en/ubuntu/+binary/lucid/1:2.32.0-0ubuntu1/2vcard/
83 url(r'^1.0/reviews/filter/(?P<language>\w+)/(?P<origin>\w+)/'
84 r'(?P<distroseries>\w+)/(?P<version>[-\w+.:~]+)/'
85 r'(?P<package_name>[\w%+.;-]+)/$',
86 show_reviews_resource, name='rnr-api-reviews-for-package'),
87 url(r'^1.0/reviews/filter/(?P<language>\w+)/(?P<origin>\w+)/'
88 r'(?P<distroseries>\w+)/(?P<version>[-\w+.:~]+)/'
89 r'(?P<package_name>[\w%+.;-]+)/page/(?P<page>\d+)/$',
90 show_reviews_resource, name='rnr-api-reviews-for-package'),
91 # XXX: michaeln 2011-02-22 bug=718898: These urls should be removed
92 # a little while after the client has updated to the rnrclient
93 # matching the above urls.
88 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'94 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
89 r'(?P<version>[-\w+.:~]+)/(?P<package_name>[\w%+.;-]+)/$',95 r'(?P<version>[-\w+.:~]+)/(?P<package_name>[\w%+.;-]+)/$',
90 show_reviews_resource, name='rnr-api-reviews-for-package'),96 show_reviews_resource, name='rnr-older-api-reviews-for-package'),
91 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'97 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
92 r'(?P<version>[-\w+.:~]+)/(?P<package_name>[\w%+.;-]+)/'98 r'(?P<version>[-\w+.:~]+)/(?P<package_name>[\w%+.;-]+)/'
93 r'page/(?P<page>\d+)/$',99 r'page/(?P<page>\d+)/$',
94 show_reviews_resource, name='rnr-api-reviews-for-package'),100 show_reviews_resource, name='rnr-older-api-reviews-for-package'),
95101
96 # achuni 2011-01-27: Support the older api for a short while, until102 # vote on the usefulness of a review
97 # the client moves over to the newer client103 # POST /1.0/reviews/405/usefulness/False/
98 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'104 url(r'^1.0/reviews/(?P<review_id>\d+)/recommendations/$',
99 r'(?P<package_name>[\w%+.;-]+)/$',105 submit_usefulness_resource, name='rnr-api-recommendations'),
100 show_reviews_resource, name='rnr-older-api-reviews-for-package',
101 kwargs={'version': 'any'}),
102 url(r'^1.0/(?P<language>\w+)/(?P<origin>\w+)/(?P<distroseries>\w+)/'
103 r'(?P<package_name>[\w%+.;-]+)/'
104 r'page/(?P<page>\d+)/$',
105 show_reviews_resource, name='rnr-older-api-reviews-for-package',
106 kwargs={'version': 'any'}),
107
108106
109 # submits a new review for a given pkg/app107 # submits a new review for a given pkg/app
110 # POST /1.0/reviews/108 # POST /1.0/reviews/
111109
=== modified file 'src/reviewsapp/utilities.py'
--- src/reviewsapp/utilities.py 2011-02-10 21:40:55 +0000
+++ src/reviewsapp/utilities.py 2011-02-22 09:51:16 +0000
@@ -212,7 +212,6 @@
212212
213 # achuni 2011-01-27: This removes older api pages from cache, and213 # achuni 2011-01-27: This removes older api pages from cache, and
214 # can be removed once the client is using the latest api.214 # can be removed once the client is using the latest api.
215 del url_kwargs['version']
216 package_url = reverse('rnr-older-api-reviews-for-package',215 package_url = reverse('rnr-older-api-reviews-for-package',
217 kwargs=url_kwargs)216 kwargs=url_kwargs)
218 key = cache_key_for_url(package_url)217 key = cache_key_for_url(package_url)

Subscribers

People subscribed via source and target branches