Merge lp:~elachuni/ubuntu-webcatalog/pep8-test into lp:ubuntu-webcatalog

Proposed by Anthony Lenton
Status: Merged
Approved by: Danny Tamez
Approved revision: 61
Merged at revision: 60
Proposed branch: lp:~elachuni/ubuntu-webcatalog/pep8-test
Merge into: lp:ubuntu-webcatalog
Diff against target: 618 lines (+144/-38)
25 files modified
setup.py (+1/-0)
src/webcatalog/admin.py (+1/-0)
src/webcatalog/api/forms.py (+2/-0)
src/webcatalog/api/handlers.py (+8/-4)
src/webcatalog/api/urls.py (+7/-3)
src/webcatalog/auth.py (+12/-7)
src/webcatalog/context_processors.py (+1/-0)
src/webcatalog/department_filters.py (+2/-0)
src/webcatalog/forms.py (+3/-2)
src/webcatalog/management/commands/import_app_install_data.py (+2/-1)
src/webcatalog/management/commands/import_for_purchase_apps.py (+3/-1)
src/webcatalog/models/applications.py (+3/-1)
src/webcatalog/models/oauthtoken.py (+1/-1)
src/webcatalog/schema.py (+1/-1)
src/webcatalog/templatetags/webcatalog.py (+1/-0)
src/webcatalog/tests/__init__.py (+1/-0)
src/webcatalog/tests/test_api.py (+3/-0)
src/webcatalog/tests/test_commands.py (+4/-5)
src/webcatalog/tests/test_models.py (+1/-1)
src/webcatalog/tests/test_pep8.py (+72/-0)
src/webcatalog/tests/test_templatetags.py (+7/-5)
src/webcatalog/tests/test_utilities.py (+4/-3)
src/webcatalog/utilities.py (+1/-1)
src/webcatalog/views.py (+1/-1)
src/webcatalog/wsgi.py (+2/-1)
To merge this branch: bzr merge lp:~elachuni/ubuntu-webcatalog/pep8-test
Reviewer Review Type Date Requested Status
Danny Tamez (community) Approve
Review via email: mp+87792@code.launchpad.net

Commit message

Added a test that checks code against PEP 8, and made it pass.

Description of the change

Overview
========
This branch adds a test that checks our code against PEP8, and makes it pass.

Details
=======
The test itself is copied over from sca/devportal.

To post a comment you must log in.
61. By Anthony Lenton

small doc fix.

Revision history for this message
Danny Tamez (zematynnad) wrote :

I always wondered how many PEP8 changes would have to be made when adding this test :)
Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2011-11-17 16:02:20 +0000
3+++ setup.py 2012-01-06 18:17:37 +0000
4@@ -47,6 +47,7 @@
5 'httplib2',
6 'django-pgtools==0.1',
7 'rnrclient==1.0',
8+ 'pep8',
9 'PIL',
10 'lazr.restfulclient',
11 ],
12
13=== modified file 'src/webcatalog/admin.py'
14--- src/webcatalog/admin.py 2011-09-12 13:37:24 +0000
15+++ src/webcatalog/admin.py 2012-01-06 18:17:37 +0000
16@@ -42,6 +42,7 @@
17 list_filter = ('distroseries', 'departments')
18 exclude = ('for_purchase', 'archive_id')
19
20+
21 class MachineAdmin(admin.ModelAdmin):
22 search_fields = ('owner__username', 'hostname', 'uuid')
23 list_display = ('hostname', 'uuid', 'owner')
24
25=== modified file 'src/webcatalog/api/forms.py'
26--- src/webcatalog/api/forms.py 2011-09-12 13:37:24 +0000
27+++ src/webcatalog/api/forms.py 2012-01-06 18:17:37 +0000
28@@ -29,6 +29,7 @@
29
30 from webcatalog.models import Machine
31
32+
33 class MachineCreateUpdateForm(forms.ModelForm):
34 class Meta:
35 model = Machine
36@@ -37,6 +38,7 @@
37 'logo_checksum',
38 )
39
40+
41 class MachineUpdatePackagesForm(forms.ModelForm):
42 class Meta:
43 model = Machine
44
45=== modified file 'src/webcatalog/api/handlers.py'
46--- src/webcatalog/api/handlers.py 2011-09-12 13:37:24 +0000
47+++ src/webcatalog/api/handlers.py 2012-01-06 18:17:37 +0000
48@@ -37,12 +37,14 @@
49 from webcatalog.models import Machine
50 from .forms import MachineCreateUpdateForm, MachineUpdatePackagesForm
51
52+
53 class ServerStatusHandler(BaseHandler):
54 allowed_methods = ('GET',)
55
56 def read(self, request):
57 return "ok"
58
59+
60 class ListMachinesHandler(BaseHandler):
61 allowed_methods = ('GET',)
62 model = Machine
63@@ -52,6 +54,7 @@
64 result = Machine.objects.filter(owner=request.user)
65 return result.defer('package_list')
66
67+
68 class MachineHandler(BaseHandler):
69 allowed_methods = ('GET', 'POST', 'DELETE')
70 model = Machine
71@@ -78,7 +81,7 @@
72 for (k, v) in form.errors.items())
73 result = {'status': 'error', 'errors': errors}
74 return result
75-
76+
77 def delete(self, request, uuid):
78 instances = Machine.objects.filter(owner=request.user, uuid=uuid)
79 if instances.count() > 0:
80@@ -86,17 +89,18 @@
81 return HttpResponse(status=204)
82 else:
83 return HttpResponseNotFound('Invalid machine UUID')
84-
85+
86
87 class PackagesHandler(BaseHandler):
88- allowed_methods = ('GET', 'POST',)
89+ allowed_methods = ('GET', 'POST',)
90+
91 def read(self, request, uuid):
92 try:
93 instance = Machine.objects.get(owner=request.user, uuid=uuid)
94 return instance.package_list
95 except Machine.DoesNotExist:
96 return HttpResponseNotFound('Invalid machine UUID')
97-
98+
99 def create(self, request, uuid):
100 try:
101 instance = Machine.objects.get(owner=request.user, uuid=uuid)
102
103=== modified file 'src/webcatalog/api/urls.py'
104--- src/webcatalog/api/urls.py 2011-09-19 19:54:15 +0000
105+++ src/webcatalog/api/urls.py 2012-01-06 18:17:37 +0000
106@@ -27,6 +27,7 @@
107
108 auth = SSOOAuthAuthentication(realm="Ubuntu Software Center")
109
110+
111 class CSRFExemptResource(Resource):
112 """A Custom Resource that is csrf exempt"""
113 def __init__(self, handler, authentication=None):
114@@ -34,9 +35,12 @@
115 self.csrf_exempt = True
116
117 server_status_resource = Resource(handler=ServerStatusHandler)
118-list_machines_resource = Resource(handler=ListMachinesHandler, authentication=auth)
119-machine_resource = CSRFExemptResource(handler=MachineHandler, authentication=auth)
120-packages_resource = CSRFExemptResource(handler=PackagesHandler, authentication=auth)
121+list_machines_resource = Resource(handler=ListMachinesHandler,
122+ authentication=auth)
123+machine_resource = CSRFExemptResource(handler=MachineHandler,
124+ authentication=auth)
125+packages_resource = CSRFExemptResource(handler=PackagesHandler,
126+ authentication=auth)
127
128 urlpatterns = patterns('',
129 # get status of the service (usually just "ok", might be "read-only")
130
131=== modified file 'src/webcatalog/auth.py'
132--- src/webcatalog/auth.py 2011-09-19 20:01:32 +0000
133+++ src/webcatalog/auth.py 2012-01-06 18:17:37 +0000
134@@ -39,8 +39,9 @@
135 full_claimed_id,
136 )
137
138-TOKEN_CACHE_EXPIRY = timedelta(hours=
139- getattr(settings, 'TOKEN_CACHE_EXPIRY_HOURS', 4))
140+TOKEN_CACHE_EXPIRY = timedelta(hours=getattr(settings,
141+ 'TOKEN_CACHE_EXPIRY_HOURS', 4))
142+
143
144 class SSOOAuthAuthentication(OAuthAuthentication):
145 """ This class is a Piston Authentication class.
146@@ -65,7 +66,7 @@
147 before the oauth mechanism asks us for them
148 """
149 http_auth = request.META.get('HTTP_AUTHORIZATION', '')
150- headers = {'Authorization' : http_auth}
151+ headers = {'Authorization': http_auth}
152 orequest = oauth.OAuthRequest.from_request(
153 request.method, request.build_absolute_uri(), headers=headers,
154 query_string=request.META['QUERY_STRING'])
155@@ -98,7 +99,8 @@
156 if len(tokens) == 0 or (tokens[0].updated_at <
157 datetime.now() - TOKEN_CACHE_EXPIRY):
158 pieces = web_services.get_data_for_account(token=oauthtoken,
159- openid_identifier=consumer_key, signature=request.get_parameter('oauth_signature'))
160+ openid_identifier=consumer_key,
161+ signature=request.get_parameter('oauth_signature'))
162 if not pieces:
163 return
164 Consumer.objects.filter(key=consumer_key).exclude(
165@@ -137,12 +139,13 @@
166 raise OAuthError('initialize_server_request returned None')
167 return oauth_server.verify_request(oauth_request)
168
169+
170 def initialize_server_request(request):
171 """
172 Shortcut for initialization.
173 """
174 headers = {
175- 'Authorization' : request.META.get('HTTP_AUTHORIZATION', '')
176+ 'Authorization': request.META.get('HTTP_AUTHORIZATION', '')
177 }
178 oauth_request = oauth.OAuthRequest.from_request(
179 request.method, request.build_absolute_uri(), headers=headers,
180@@ -150,8 +153,10 @@
181
182 if oauth_request:
183 oauth_server = oauth.OAuthServer(oauth_datastore(oauth_request))
184- oauth_server.add_signature_method(oauth.OAuthSignatureMethod_PLAINTEXT())
185- oauth_server.add_signature_method(oauth.OAuthSignatureMethod_HMAC_SHA1())
186+ oauth_server.add_signature_method(
187+ oauth.OAuthSignatureMethod_PLAINTEXT())
188+ oauth_server.add_signature_method(
189+ oauth.OAuthSignatureMethod_HMAC_SHA1())
190 else:
191 oauth_server = None
192
193
194=== modified file 'src/webcatalog/context_processors.py'
195--- src/webcatalog/context_processors.py 2012-01-06 14:24:49 +0000
196+++ src/webcatalog/context_processors.py 2012-01-06 18:17:37 +0000
197@@ -19,6 +19,7 @@
198
199 from django.conf import settings
200
201+
202 def google_analytics_id(request):
203 """Adds the google analytics id to the context if it's present."""
204 return {
205
206=== modified file 'src/webcatalog/department_filters.py'
207--- src/webcatalog/department_filters.py 2011-09-12 13:37:24 +0000
208+++ src/webcatalog/department_filters.py 2012-01-06 18:17:37 +0000
209@@ -38,12 +38,14 @@
210 return bool(app.categories_set.intersection(categories_set))
211 return filter_func
212
213+
214 def package_name_filter(name_regex):
215 """Returns a filter func that checks if an app's name matches a regex"""
216 def filter_func(app):
217 return re.match(name_regex, app.package_name) is not None
218 return filter_func
219
220+
221 def section_filter(sections):
222 """Returns a filter that checks if an app is in certain sections."""
223 def filter_func(app):
224
225=== modified file 'src/webcatalog/forms.py'
226--- src/webcatalog/forms.py 2011-09-12 13:37:24 +0000
227+++ src/webcatalog/forms.py 2012-01-06 18:17:37 +0000
228@@ -53,7 +53,7 @@
229
230 class Meta:
231 model = Application
232- exclude = ('distroseries','for_purchase', 'archive_id', 'price')
233+ exclude = ('distroseries', 'for_purchase', 'archive_id', 'price')
234
235 @classmethod
236 def get_form_from_desktop_data(cls, str_data, distroseries):
237@@ -61,7 +61,7 @@
238 parser.readfp(StringIO(str_data))
239 data = dict(parser.items('Desktop Entry'))
240 for desktop_key, app_key in desktop_field_mappings.items():
241- if data.has_key(desktop_key):
242+ if desktop_key in data:
243 data[app_key] = data[desktop_key]
244 del(data[desktop_key])
245
246@@ -86,6 +86,7 @@
247
248 return cleaned_data
249
250+
251 class ForPurchaseApplicationForm(forms.ModelForm):
252 class Meta:
253 model = Application
254
255=== modified file 'src/webcatalog/management/commands/import_app_install_data.py'
256--- src/webcatalog/management/commands/import_app_install_data.py 2011-09-12 13:37:24 +0000
257+++ src/webcatalog/management/commands/import_app_install_data.py 2012-01-06 18:17:37 +0000
258@@ -135,7 +135,8 @@
259
260 # Extract and parse the deb archive.
261 deb_file = DebFile(deb_location)
262- self.output("Processing application data to update database...\n", 1)
263+ self.output("Processing application data to update database...\n",
264+ 1)
265 deb_file.data.extractall(data_dir)
266 matcher = data_dir + '/usr/share/app-install/desktop/*.desktop'
267 icon_dir = data_dir + '/usr/share/app-install/icons/'
268
269=== modified file 'src/webcatalog/management/commands/import_for_purchase_apps.py'
270--- src/webcatalog/management/commands/import_for_purchase_apps.py 2011-09-15 08:58:19 +0000
271+++ src/webcatalog/management/commands/import_for_purchase_apps.py 2012-01-06 18:17:37 +0000
272@@ -15,7 +15,9 @@
273 # You should have received a copy of the GNU Affero General Public License
274 # along with this program. If not, see <http://www.gnu.org/licenses/>.
275
276-"""Management command to import for purchase applications from Software Center."""
277+"""Management command to import for purchase applications from Software
278+ Center.
279+"""
280
281 from __future__ import (
282 absolute_import,
283
284=== modified file 'src/webcatalog/models/applications.py'
285--- src/webcatalog/models/applications.py 2011-09-12 13:37:24 +0000
286+++ src/webcatalog/models/applications.py 2012-01-06 18:17:37 +0000
287@@ -175,7 +175,7 @@
288 if distro is not None:
289 args = [distro]
290 args.append(self.id)
291- url =reverse('wc-department', args=args)
292+ url = reverse('wc-department', args=args)
293 crumbs.append({'name': self.name, 'url': url})
294 return crumbs
295
296@@ -186,6 +186,7 @@
297 class ReviewStatsImport(models.Model):
298 distroseries = models.ForeignKey(DistroSeries, unique=True)
299 last_import = models.DateTimeField(default=datetime.utcnow)
300+
301 class Meta:
302 app_label = 'webcatalog'
303
304@@ -197,6 +198,7 @@
305 packages_checksum = models.CharField(max_length=56)
306 package_list = models.TextField()
307 logo_checksum = models.CharField(max_length=56, blank=True)
308+
309 class Meta:
310 app_label = 'webcatalog'
311 unique_together = ('owner', 'uuid')
312
313=== modified file 'src/webcatalog/models/oauthtoken.py'
314--- src/webcatalog/models/oauthtoken.py 2011-09-12 13:37:24 +0000
315+++ src/webcatalog/models/oauthtoken.py 2012-01-06 18:17:37 +0000
316@@ -151,6 +151,7 @@
317 class Meta:
318 app_label = 'webcatalog'
319
320+
321 class DataStore(OAuthDataStore):
322
323 def lookup_token(self, token_type, token_field):
324@@ -186,7 +187,6 @@
325 if consumer is not None:
326 return consumer.oauth_consumer()
327
328-
329 def lookup_nonce(self, consumer, token, nonce):
330 """
331 :param consumer: OAuthConsumer object
332
333=== modified file 'src/webcatalog/schema.py'
334--- src/webcatalog/schema.py 2012-01-06 14:24:49 +0000
335+++ src/webcatalog/schema.py 2012-01-06 18:17:37 +0000
336@@ -76,7 +76,7 @@
337 rnr = ConfigSection()
338 rnr.rnr_service_root = StringConfigOption(
339 default="http://reviews.ubuntu.com/reviews/api/1.0")
340- rnr.reviews_cache_timeout = IntConfigOption(default=60*15)
341+ rnr.reviews_cache_timeout = IntConfigOption(default=60 * 15)
342
343 sso_api = ConfigSection()
344 sso_api.sso_api_service_root = StringConfigOption()
345
346=== modified file 'src/webcatalog/templatetags/webcatalog.py'
347--- src/webcatalog/templatetags/webcatalog.py 2011-09-15 10:53:40 +0000
348+++ src/webcatalog/templatetags/webcatalog.py 2012-01-06 18:17:37 +0000
349@@ -155,6 +155,7 @@
350 old_indent_level = indent_level
351 return norm_description.strip()
352
353+
354 @register.filter
355 def htmlize_package_description(desc):
356 html = ""
357
358=== modified file 'src/webcatalog/tests/__init__.py'
359--- src/webcatalog/tests/__init__.py 2012-01-06 14:24:49 +0000
360+++ src/webcatalog/tests/__init__.py 2012-01-06 18:17:37 +0000
361@@ -23,6 +23,7 @@
362 from .test_forms import *
363 from .test_handlers import *
364 from .test_models import *
365+from .test_pep8 import *
366 from .test_templatetags import *
367 from .test_utilities import *
368 from .test_views import *
369
370=== modified file 'src/webcatalog/tests/test_api.py'
371--- src/webcatalog/tests/test_api.py 2011-09-12 13:37:24 +0000
372+++ src/webcatalog/tests/test_api.py 2012-01-06 18:17:37 +0000
373@@ -43,11 +43,13 @@
374 from .factory import TestCaseWithFactory
375 from webcatalog.models import Machine
376
377+
378 class ServerStatusTestCase(TestCase):
379 def test_server_status(self):
380 response = self.client.get('/cat/api/1.0/server-status/')
381 self.assertEqual(response.content, '"ok"')
382
383+
384 class AuthenticatedAPITestCase(TestCaseWithFactory):
385 def auth_header_for_user(self, url, user=None, realm='OAuth'):
386 token, consumer = self.factory.make_oauth_token_and_consumer(user=user)
387@@ -63,6 +65,7 @@
388
389 class ListMachinesTestCase(AuthenticatedAPITestCase):
390 url = '/cat/api/1.0/list-machines/'
391+
392 def test_no_auth_returns_401(self):
393 response = self.client.get(self.url)
394 self.assertEqual(401, response.status_code)
395
396=== modified file 'src/webcatalog/tests/test_commands.py'
397--- src/webcatalog/tests/test_commands.py 2011-09-15 10:53:40 +0000
398+++ src/webcatalog/tests/test_commands.py 2012-01-06 18:17:37 +0000
399@@ -89,9 +89,9 @@
400 mock_cache = MagicMock()
401 mock_apt_firefox = self.make_mock_apt_package('firefox',
402 description="Firefox description")
403- mock_apt_scribus=self.make_mock_apt_package('scribus',
404+ mock_apt_scribus = self.make_mock_apt_package('scribus',
405 description="Scribus description")
406- mock_other_app=self.make_mock_apt_package('otherapp',
407+ mock_other_app = self.make_mock_apt_package('otherapp',
408 description="Otherapp description",
409 summary="Otherapp the Internet\nA tagline for Otherapp")
410 mock_app_install_data = self.make_mock_apt_package('app-install-data',
411@@ -169,7 +169,8 @@
412 with patch(get_uri_fn) as mock_get_uri:
413 mock_get_uri.return_value = 'http://example.com/my.deb'
414 with patch('urllib.urlretrieve') as mock_urlretrieve:
415- ImportAppInstallCommand().get_latest_app_data_for_series('natty', tmp_dir)
416+ ImportAppInstallCommand().get_latest_app_data_for_series(
417+ 'natty', tmp_dir)
418 shutil.rmtree(tmp_dir)
419
420 mock_urlretrieve.assert_called_with(
421@@ -540,5 +541,3 @@
422
423 # update_apps_with_stats returns None on success:
424 self.assertIsNone(command.update_apps_with_stats(natty, stats))
425-
426-
427
428=== modified file 'src/webcatalog/tests/test_models.py'
429--- src/webcatalog/tests/test_models.py 2011-09-12 13:37:24 +0000
430+++ src/webcatalog/tests/test_models.py 2012-01-06 18:17:37 +0000
431@@ -102,7 +102,7 @@
432 def test_normalized_name(self):
433 cases = {
434 'Foo': 'Foo',
435- 'Foo & Bar': 'FooBar',
436+ 'Foo & Bar': 'FooBar',
437 ' Foo, Bar ': 'FooBar',
438 ' && , ': '',
439 '': ''
440
441=== added file 'src/webcatalog/tests/test_pep8.py'
442--- src/webcatalog/tests/test_pep8.py 1970-01-01 00:00:00 +0000
443+++ src/webcatalog/tests/test_pep8.py 2012-01-06 18:17:37 +0000
444@@ -0,0 +1,72 @@
445+# -*- coding: utf-8 -*-
446+# This file is part of the Apps Directory
447+# Copyright (C) 2011 Canonical Ltd.
448+#
449+# This program is free software: you can redistribute it and/or modify
450+# it under the terms of the GNU Affero General Public License as
451+# published by the Free Software Foundation, either version 3 of the
452+# License, or (at your option) any later version.
453+#
454+# This program is distributed in the hope that it will be useful,
455+# but WITHOUT ANY WARRANTY; without even the implied warranty of
456+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
457+# GNU Affero General Public License for more details.
458+#
459+# You should have received a copy of the GNU Affero General Public License
460+# along with this program. If not, see <http://www.gnu.org/licenses/>.
461+
462+"""Apps Directory pep-8 compliance tests."""
463+
464+from __future__ import absolute_import
465+
466+__metaclass__ = type
467+__all__ = [
468+ 'WebCatalogPep8TestCase',
469+ ]
470+
471+import os
472+import pep8
473+from collections import defaultdict
474+from unittest import TestCase
475+
476+import webcatalog
477+
478+
479+class PackagePep8TestCase(TestCase):
480+ maxDiff = None
481+ packages = []
482+ exclude = ['migrations']
483+
484+ def message(self, text):
485+ self.errors.append(text)
486+
487+ def setUp(self):
488+ self.errors = []
489+
490+ class Options(object):
491+ exclude = self.exclude
492+ filename = ['*.py']
493+ testsuite = ''
494+ doctest = ''
495+ counters = defaultdict(int)
496+ messages = {}
497+ verbose = 0
498+ quiet = 0
499+ repeat = True
500+ show_source = False
501+ show_pep8 = False
502+ select = []
503+ ignore = []
504+ pep8.options = Options()
505+ pep8.message = self.message
506+ Options.physical_checks = pep8.find_checks('physical_line')
507+ Options.logical_checks = pep8.find_checks('logical_line')
508+
509+ def test_all_code(self):
510+ for package in self.packages:
511+ pep8.input_dir(os.path.dirname(package.__file__))
512+ self.assertEqual([], self.errors)
513+
514+
515+class WebCatalogPep8TestCase(PackagePep8TestCase):
516+ packages = [webcatalog]
517
518=== modified file 'src/webcatalog/tests/test_templatetags.py'
519--- src/webcatalog/tests/test_templatetags.py 2011-09-15 10:53:40 +0000
520+++ src/webcatalog/tests/test_templatetags.py 2012-01-06 18:17:37 +0000
521@@ -182,7 +182,8 @@
522 * Lha archives (.lzh)
523 * Single files compressed with gzip (.gz), bzip (.bz), bzip2 (.bz2),
524 compress (.Z), lzip (.lz), lzop (.lzo), lzma (.lzma) and xz (.xz)
525-File-roller doesn't perform archive operations by itself, but relies on standard tools for this.
526+File-roller doesn't perform archive operations by itself, but relies on \
527+standard tools for this.
528 """
529
530 #drgeo
531@@ -240,6 +241,7 @@
532 * Extensible with plugins
533 """
534
535+
536 class HtmlizePackageDescriptionTestCase(unittest.TestCase):
537 def test_htmlize(self):
538 for descr in [d1, d2, d3]:
539@@ -275,13 +277,13 @@
540 class VisiblePageRangeTestCase(unittest.TestCase):
541 def test_visible_page_range(self):
542 cases = [
543- ( 2, 1, [1, 2]),
544+ (2, 1, [1, 2]),
545 (20, 1, range(1, 11)),
546- ( 3, 2, [1, 2, 3]),
547+ (3, 2, [1, 2, 3]),
548 (20, 2, range(1, 11)),
549- ( 4, 4, [1, 2, 3, 4]),
550+ (4, 4, [1, 2, 3, 4]),
551 (20, 8, range(3, 13)),
552- ( 8, 8, range(3, 9)),
553+ (8, 8, range(3, 9)),
554 (20, 18, range(13, 21)),
555 (400, 400, range(395, 401)),
556 ]
557
558=== modified file 'src/webcatalog/tests/test_utilities.py'
559--- src/webcatalog/tests/test_utilities.py 2011-09-12 13:37:24 +0000
560+++ src/webcatalog/tests/test_utilities.py 2012-01-06 18:17:37 +0000
561@@ -22,12 +22,13 @@
562 from webcatalog.tests.factory import TestCaseWithFactory
563 from webcatalog.utilities import create_png_from_file
564
565+
566 class CreatePNGFromFileTestCase(TestCaseWithFactory):
567 def test_file_conversion(self):
568 filenames = [
569- self.factory.get_test_path('firefox.xpm'), # Regular xpm
570- self.factory.get_test_path('mini-gsmc.xpm'), # named colors
571- self.factory.get_test_path('access.svg'), # SVG file
572+ self.factory.get_test_path('firefox.xpm'), # Regular xpm
573+ self.factory.get_test_path('mini-gsmc.xpm'), # named colors
574+ self.factory.get_test_path('access.svg'), # SVG file
575 ]
576 pngpath = 'test_file_DELETEME.png'
577 for f in filenames:
578
579=== modified file 'src/webcatalog/utilities.py'
580--- src/webcatalog/utilities.py 2011-09-15 13:40:53 +0000
581+++ src/webcatalog/utilities.py 2012-01-06 18:17:37 +0000
582@@ -102,7 +102,7 @@
583 if cached_reviews is not None:
584 return cached_reviews
585
586- fresh_reviews = self.rnr_api.get_reviews(packagename=package_name,
587+ fresh_reviews = self.rnr_api.get_reviews(packagename=package_name,
588 distroseries=distroseries, page=page)
589 cache.set(key, fresh_reviews, settings.REVIEWS_CACHE_TIMEOUT)
590 return fresh_reviews
591
592=== modified file 'src/webcatalog/views.py'
593--- src/webcatalog/views.py 2011-09-16 09:43:11 +0000
594+++ src/webcatalog/views.py 2012-01-06 18:17:37 +0000
595@@ -182,7 +182,7 @@
596 app = get_object_or_404(Application, package_name=package_name,
597 distroseries__code_name=distro)
598 # XXX michaeln 2011-09-15 bug=851662 Better review language options.
599- reviews = WebServices().get_reviews_for_package(package_name,
600+ reviews = WebServices().get_reviews_for_package(package_name,
601 distroseries=distro, page=page)
602
603 context = dict(application=app, reviews=reviews)
604
605=== modified file 'src/webcatalog/wsgi.py'
606--- src/webcatalog/wsgi.py 2011-09-12 13:37:24 +0000
607+++ src/webcatalog/wsgi.py 2012-01-06 18:17:37 +0000
608@@ -25,8 +25,9 @@
609 from django.core.handlers.wsgi import WSGIHandler
610 from django.conf import settings
611
612+
613 def make_app():
614- """Encapsulate our webcatalog handler in an OOPS app for error reporting."""
615+ """Encapsulate our webcatalog handler in an OOPS app."""
616 default_id = ''.join(x for x in platform.node() if x.isalpha())
617 appserver_id = getattr(settings, 'APPSERVER_ID', default_id)
618 logging.config.fileConfig(settings.WEBAPP_LOGGING_CONFIG)

Subscribers

People subscribed via source and target branches