Merge lp:~nataliabidart/ubuntu-webcatalog/law-and-order.1 into lp:ubuntu-webcatalog

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 134
Merged at revision: 134
Proposed branch: lp:~nataliabidart/ubuntu-webcatalog/law-and-order.1
Merge into: lp:ubuntu-webcatalog
Prerequisite: lp:~nataliabidart/ubuntu-webcatalog/law-and-order
Diff against target: 511 lines (+78/-72)
13 files modified
src/webcatalog/api/forms.py (+2/-2)
src/webcatalog/api/handlers.py (+1/-1)
src/webcatalog/api/urls.py (+5/-4)
src/webcatalog/management/commands/check_all_latest.py (+4/-4)
src/webcatalog/management/commands/cleanup.py (+6/-4)
src/webcatalog/management/commands/import_app_install_data.py (+21/-18)
src/webcatalog/management/commands/import_exhibits.py (+5/-5)
src/webcatalog/management/commands/import_for_purchase_apps.py (+2/-3)
src/webcatalog/management/commands/import_ratings_stats.py (+3/-3)
src/webcatalog/middleware/exception.py (+3/-3)
src/webcatalog/models/applications.py (+19/-17)
src/webcatalog/models/oauthtoken.py (+4/-5)
src/webcatalog/templatetags/webcatalog.py (+3/-3)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-webcatalog/law-and-order.1
Reviewer Review Type Date Requested Status
Anthony Lenton (community) Approve
Review via email: mp+108993@code.launchpad.net

Commit message

- Fixing pep8 issues (part 1 of LP: #1007626).

To post a comment you must log in.
Revision history for this message
Anthony Lenton (elachuni) wrote :

+1

review: Approve
Revision history for this message
ISD Branch Mangler (isd-branches-mangler) wrote :

The prerequisite lp:~nataliabidart/ubuntu-webcatalog/law-and-order has not yet been merged into lp:ubuntu-webcatalog.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/webcatalog/api/forms.py'
--- src/webcatalog/api/forms.py 2012-01-06 17:54:47 +0000
+++ src/webcatalog/api/forms.py 2012-06-06 16:45:24 +0000
@@ -36,7 +36,7 @@
36 fields = (36 fields = (
37 'hostname',37 'hostname',
38 'logo_checksum',38 'logo_checksum',
39 )39 )
4040
4141
42class MachineUpdatePackagesForm(forms.ModelForm):42class MachineUpdatePackagesForm(forms.ModelForm):
@@ -45,4 +45,4 @@
45 fields = (45 fields = (
46 'packages_checksum',46 'packages_checksum',
47 'package_list',47 'package_list',
48 )48 )
4949
=== modified file 'src/webcatalog/api/handlers.py'
--- src/webcatalog/api/handlers.py 2012-03-23 20:14:03 +0000
+++ src/webcatalog/api/handlers.py 2012-06-06 16:45:24 +0000
@@ -28,7 +28,7 @@
28 HttpResponse,28 HttpResponse,
29 HttpResponseBadRequest,29 HttpResponseBadRequest,
30 HttpResponseNotFound,30 HttpResponseNotFound,
31 )31)
32from piston.handler import BaseHandler32from piston.handler import BaseHandler
3333
34from webcatalog.models import Machine34from webcatalog.models import Machine
3535
=== modified file 'src/webcatalog/api/urls.py'
--- src/webcatalog/api/urls.py 2012-04-18 22:29:29 +0000
+++ src/webcatalog/api/urls.py 2012-06-06 16:45:24 +0000
@@ -37,13 +37,14 @@
3737
38server_status_resource = never_cache(Resource(handler=ServerStatusHandler))38server_status_resource = never_cache(Resource(handler=ServerStatusHandler))
39list_machines_resource = never_cache(Resource(handler=ListMachinesHandler,39list_machines_resource = never_cache(Resource(handler=ListMachinesHandler,
40 authentication=auth))40 authentication=auth))
41machine_resource = never_cache(CSRFExemptResource(handler=MachineHandler,41machine_resource = never_cache(CSRFExemptResource(handler=MachineHandler,
42 authentication=auth))42 authentication=auth))
43packages_resource = never_cache(CSRFExemptResource(handler=PackagesHandler,43packages_resource = never_cache(CSRFExemptResource(handler=PackagesHandler,
44 authentication=auth))44 authentication=auth))
4545
46urlpatterns = patterns('',46urlpatterns = patterns(
47 '',
47 # get status of the service (usually just "ok", might be "read-only")48 # get status of the service (usually just "ok", might be "read-only")
48 # to ensure we inform the user when he wants to write a review or49 # to ensure we inform the user when he wants to write a review or
49 # send a moderation request50 # send a moderation request
5051
=== modified file 'src/webcatalog/management/commands/check_all_latest.py'
--- src/webcatalog/management/commands/check_all_latest.py 2012-03-16 04:25:10 +0000
+++ src/webcatalog/management/commands/check_all_latest.py 2012-06-06 16:45:24 +0000
@@ -19,7 +19,7 @@
1919
20from __future__ import (20from __future__ import (
21 absolute_import,21 absolute_import,
22 )22)
2323
24from django.core.management.base import BaseCommand24from django.core.management.base import BaseCommand
2525
@@ -28,7 +28,7 @@
28__metaclass__ = type28__metaclass__ = type
29__all__ = [29__all__ = [
30 'Command',30 'Command',
31 ]31]
3232
33BATCH_SIZE = 20033BATCH_SIZE = 200
3434
@@ -48,8 +48,8 @@
48 Application.objects.all().update(is_latest=False)48 Application.objects.all().update(is_latest=False)
4949
50 # 2. Update is_latest in batches of BATCH_SIZE.50 # 2. Update is_latest in batches of BATCH_SIZE.
51 packages = Application.objects.values_list('id',51 packages = Application.objects.values_list('id', 'package_name')
52 'package_name').order_by('package_name', '-distroseries__version')52 packages = packages.order_by('package_name', '-distroseries__version')
53 current_package_name = None53 current_package_name = None
54 to_update = []54 to_update = []
55 for app_id, app_package_name in packages:55 for app_id, app_package_name in packages:
5656
=== modified file 'src/webcatalog/management/commands/cleanup.py'
--- src/webcatalog/management/commands/cleanup.py 2012-04-17 16:56:44 +0000
+++ src/webcatalog/management/commands/cleanup.py 2012-06-06 16:45:24 +0000
@@ -106,13 +106,15 @@
106 help = "Cleans the Django session and OAuth nonce tables."106 help = "Cleans the Django session and OAuth nonce tables."
107107
108 option_list = LabelCommand.option_list + (108 option_list = LabelCommand.option_list + (
109 make_option('--cursor-life', default=3600, dest="cursor_secs",109 make_option(
110 '--cursor-life', default=3600, dest="cursor_secs",
110 action='store',111 action='store',
111 help="Hold a cursor open a maximum of SECS seconds"),112 help="Hold a cursor open a maximum of SECS seconds"),
112 make_option('--batch-time', default=5, dest="batch_secs",113 make_option(
114 '--batch-time', default=5, dest="batch_secs",
113 action="store",115 action="store",
114 help="Try to keep batch removal transaction time to SECS seconds"),116 help="Try to keep batch removal transaction time to SECS seconds"),
115 )117 )
116118
117 def handle_label(self, table, **options):119 def handle_label(self, table, **options):
118 if not psycopg2_available:120 if not psycopg2_available:
@@ -124,7 +126,7 @@
124 cleaner_cls = CLEANERS.get(table, None)126 cleaner_cls = CLEANERS.get(table, None)
125 if cleaner_cls is None:127 if cleaner_cls is None:
126 msg = ("Invalid cleaner.\nNo cleaner found for table: %s\n"128 msg = ("Invalid cleaner.\nNo cleaner found for table: %s\n"
127 "Supported tables are: %s" % (table, CLEANERS.keys()))129 "Supported tables are: %s" % (table, CLEANERS.keys()))
128 raise CommandError(msg)130 raise CommandError(msg)
129 cleaner = cleaner_cls()131 cleaner = cleaner_cls()
130 connection.isolation_level = ISOLATION_LEVEL_AUTOCOMMIT132 connection.isolation_level = ISOLATION_LEVEL_AUTOCOMMIT
131133
=== modified file 'src/webcatalog/management/commands/import_app_install_data.py'
--- src/webcatalog/management/commands/import_app_install_data.py 2012-05-09 15:31:34 +0000
+++ src/webcatalog/management/commands/import_app_install_data.py 2012-06-06 16:45:24 +0000
@@ -20,7 +20,7 @@
20from __future__ import (20from __future__ import (
21 absolute_import,21 absolute_import,
22 with_statement,22 with_statement,
23 )23)
2424
25import os25import os
26import re26import re
@@ -43,12 +43,11 @@
43from webcatalog.models import (43from webcatalog.models import (
44 Application,44 Application,
45 DistroSeries,45 DistroSeries,
46 )46)
47from webcatalog.utilities import create_png_from_file47from webcatalog.utilities import create_png_from_file
4848
49__metaclass__ = type49__metaclass__ = type
50__all__ = [50__all__ = []
51 ]
5251
5352
54class CacheMaker(object):53class CacheMaker(object):
@@ -97,21 +96,23 @@
97class Command(LabelCommand):96class Command(LabelCommand):
9897
99 help = ("Update Application data from apt cache and "98 help = ("Update Application data from apt cache and "
100 "app-install-data(-partner) packages.")99 "app-install-data(-partner) packages.")
101 option_list = LabelCommand.option_list + (100 option_list = LabelCommand.option_list + (
102 make_option('--local-app-install-data',101 make_option(
102 '--local-app-install-data',
103 action='store',103 action='store',
104 dest='local_app_install_data',104 dest='local_app_install_data',
105 default='',105 default='',
106 help=('Use a local app-install-data deb package rather than '106 help=('Use a local app-install-data deb package rather than '
107 'downloading from the archive.')),107 'downloading from the archive.')),
108 make_option('--local-app-install-data-partner',108 make_option(
109 '--local-app-install-data-partner',
109 action='store',110 action='store',
110 dest='local_app_install_data_partner',111 dest='local_app_install_data_partner',
111 default='',112 default='',
112 help=('Use a local app-install-data-partner deb package rather '113 help=('Use a local app-install-data-partner deb package rather '
113 'than downloading from the archive.')),114 'than downloading from the archive.')),
114 )115 )
115 verbosity = 1116 verbosity = 1
116117
117 def set_cache(self, distroseries):118 def set_cache(self, distroseries):
@@ -141,12 +142,12 @@
141 self.update_from_app_data(package, distroseries, deb_location)142 self.update_from_app_data(package, distroseries, deb_location)
142143
143 def update_from_app_data(self, package_name, distroseries,144 def update_from_app_data(self, package_name, distroseries,
144 deb_location=''):145 deb_location=''):
145 data_dir = tempfile.mkdtemp()146 data_dir = tempfile.mkdtemp()
146 # Download app install data if necessary147 # Download app install data if necessary
147 if deb_location == '':148 if deb_location == '':
148 deb_location = self.get_package_data_for_series(package_name,149 deb_location = self.get_package_data_for_series(
149 distroseries.code_name, data_dir)150 package_name, distroseries.code_name, data_dir)
150151
151 # Extract and parse the deb archive.152 # Extract and parse the deb archive.
152 deb_file = DebFile(deb_location)153 deb_file = DebFile(deb_location)
@@ -166,7 +167,7 @@
166 shutil.rmtree(data_dir)167 shutil.rmtree(data_dir)
167168
168 def get_package_data_for_series(self, package_name, distroseries,169 def get_package_data_for_series(self, package_name, distroseries,
169 working_dir):170 working_dir):
170 install_data_url = self.get_package_uri_for_series(171 install_data_url = self.get_package_uri_for_series(
171 package_name, distroseries)172 package_name, distroseries)
172 rest, sep, deb_filename = install_data_url.rpartition('/')173 rest, sep, deb_filename = install_data_url.rpartition('/')
@@ -180,7 +181,7 @@
180181
181 def get_package_uri_for_series(self, package_name, distroseries):182 def get_package_uri_for_series(self, package_name, distroseries):
182 self.output("Determining URI for current version of "183 self.output("Determining URI for current version of "
183 "{0} in {1}.\n".format(package_name, distroseries), 1)184 "{0} in {1}.\n".format(package_name, distroseries), 1)
184 self.set_cache(distroseries)185 self.set_cache(distroseries)
185 return self.cache[package_name].candidate.uri186 return self.cache[package_name].candidate.uri
186187
@@ -267,10 +268,11 @@
267 distroseries, created = DistroSeries.objects.get_or_create(268 distroseries, created = DistroSeries.objects.get_or_create(
268 code_name=distroseries_name)269 code_name=distroseries_name)
269 if created:270 if created:
270 self.output("Created a DistroSeries record called '{0}'.\n".format(271 msg = "Created a DistroSeries record called '{0}'.\n"
271 distroseries_name), 1)272 self.output(msg.format(distroseries_name), 1)
272273
273 prefetched_apps = dict((app.package_name, app) for app in274 prefetched_apps = dict(
275 (app.package_name, app) for app in
274 Application.objects.filter(distroseries=distroseries))276 Application.objects.filter(distroseries=distroseries))
275277
276 self.set_cache(distroseries_name)278 self.set_cache(distroseries_name)
@@ -297,7 +299,8 @@
297 for attribute, value in [299 for attribute, value in [
298 ('description', candidate.description),300 ('description', candidate.description),
299 ('section', candidate.section), ('version', version),301 ('section', candidate.section), ('version', version),
300 ('name', app_name), ('comment', app_comment)]:302 ('name', app_name), ('comment', app_comment),
303 ]:
301 if getattr(app, attribute) != value:304 if getattr(app, attribute) != value:
302 setattr(app, attribute, value)305 setattr(app, attribute, value)
303 updated = True306 updated = True
@@ -312,7 +315,7 @@
312 name=app_name,315 name=app_name,
313 version=version,316 version=version,
314 comment=app_comment,317 comment=app_comment,
315 )318 )
316319
317 screenshot_url = package.candidateRecord.get('Screenshot-Url')320 screenshot_url = package.candidateRecord.get('Screenshot-Url')
318 if screenshot_url is not None and (321 if screenshot_url is not None and (
319322
=== modified file 'src/webcatalog/management/commands/import_exhibits.py'
--- src/webcatalog/management/commands/import_exhibits.py 2012-04-13 20:49:20 +0000
+++ src/webcatalog/management/commands/import_exhibits.py 2012-06-06 16:45:24 +0000
@@ -19,7 +19,7 @@
1919
20from __future__ import (20from __future__ import (
21 absolute_import,21 absolute_import,
22 )22)
2323
24import json24import json
25import urllib25import urllib
@@ -31,12 +31,12 @@
31from webcatalog.models import (31from webcatalog.models import (
32 DistroSeries,32 DistroSeries,
33 Exhibit,33 Exhibit,
34 )34)
3535
36__metaclass__ = type36__metaclass__ = type
37__all__ = [37__all__ = [
38 'Command',38 'Command',
39 ]39]
4040
4141
42class Command(BaseCommand):42class Command(BaseCommand):
@@ -71,7 +71,7 @@
71 Exhibit.objects.filter(pk=instance.pk).update(**args)71 Exhibit.objects.filter(pk=instance.pk).update(**args)
7272
73 distroseries = [DistroSeries.objects.get_or_create(**ds)[0]73 distroseries = [DistroSeries.objects.get_or_create(**ds)[0]
74 for ds in exhibit.get('distroseries', [])]74 for ds in exhibit.get('distroseries', [])]
7575
76 to_remove = instance.distroseries.exclude(76 to_remove = instance.distroseries.exclude(
77 pk__in=[x.id for x in distroseries])77 pk__in=[x.id for x in distroseries])
@@ -81,4 +81,4 @@
81 # Unpublish other exhibits81 # Unpublish other exhibits
82 Exhibit.objects.filter(published=True).exclude(82 Exhibit.objects.filter(published=True).exclude(
83 sca_id__in=[xibit['id'] for xibit in exhibits]).update(83 sca_id__in=[xibit['id'] for xibit in exhibits]).update(
84 published=False)84 published=False)
8585
=== modified file 'src/webcatalog/management/commands/import_for_purchase_apps.py'
--- src/webcatalog/management/commands/import_for_purchase_apps.py 2012-05-02 14:58:15 +0000
+++ src/webcatalog/management/commands/import_for_purchase_apps.py 2012-06-06 16:45:24 +0000
@@ -22,7 +22,7 @@
22from __future__ import (22from __future__ import (
23 absolute_import,23 absolute_import,
24 with_statement,24 with_statement,
25 )25)
2626
27import json27import json
28import os28import os
@@ -41,8 +41,7 @@
41)41)
4242
43__metaclass__ = type43__metaclass__ = type
44__all__ = [44__all__ = []
45 ]
4645
4746
48class Command(BaseCommand):47class Command(BaseCommand):
4948
=== modified file 'src/webcatalog/management/commands/import_ratings_stats.py'
--- src/webcatalog/management/commands/import_ratings_stats.py 2012-03-20 22:23:31 +0000
+++ src/webcatalog/management/commands/import_ratings_stats.py 2012-06-06 16:45:24 +0000
@@ -20,7 +20,7 @@
20from datetime import (20from datetime import (
21 datetime,21 datetime,
22 timedelta,22 timedelta,
23 )23)
24import json24import json
2525
26from django.core.management.base import LabelCommand26from django.core.management.base import LabelCommand
@@ -29,11 +29,11 @@
29 Application,29 Application,
30 DistroSeries,30 DistroSeries,
31 ReviewStatsImport,31 ReviewStatsImport,
32 )32)
33from webcatalog.utilities import (33from webcatalog.utilities import (
34 dampened_rating,34 dampened_rating,
35 WebServices,35 WebServices,
36 )36)
3737
3838
39class Command(LabelCommand):39class Command(LabelCommand):
4040
=== modified file 'src/webcatalog/middleware/exception.py'
--- src/webcatalog/middleware/exception.py 2011-09-12 13:58:47 +0000
+++ src/webcatalog/middleware/exception.py 2012-06-06 16:45:24 +0000
@@ -55,9 +55,9 @@
55 lineno = tb.tb_lineno - 155 lineno = tb.tb_lineno - 1
56 loader = tb.tb_frame.f_globals.get('__loader__')56 loader = tb.tb_frame.f_globals.get('__loader__')
57 module_name = tb.tb_frame.f_globals.get('__name__')57 module_name = tb.tb_frame.f_globals.get('__name__')
58 pre_context_lineno, pre_context, context_line, post_context = \58 lines = self._get_lines_from_file(
59 self._get_lines_from_file(filename, lineno, 7, loader,59 filename, lineno, 7, loader, module_name)
60 module_name)60 pre_context_lineno, pre_context, context_line, post_context = lines
61 if pre_context_lineno is not None:61 if pre_context_lineno is not None:
62 frames.append({62 frames.append({
63 'tb': tb,63 'tb': tb,
6464
=== modified file 'src/webcatalog/models/applications.py'
--- src/webcatalog/models/applications.py 2012-06-06 16:45:24 +0000
+++ src/webcatalog/models/applications.py 2012-06-06 16:45:24 +0000
@@ -20,7 +20,7 @@
20from __future__ import (20from __future__ import (
21 absolute_import,21 absolute_import,
22 with_statement,22 with_statement,
23 )23)
2424
25import logging25import logging
26from datetime import datetime26from datetime import datetime
@@ -43,7 +43,7 @@
43 'Exhibit',43 'Exhibit',
44 'Machine',44 'Machine',
45 'ReviewStatsImport',45 'ReviewStatsImport',
46 ]46]
4747
4848
49class DistroSeries(models.Model):49class DistroSeries(models.Model):
@@ -82,18 +82,19 @@
82 categories = models.CharField(max_length=255, blank=True)82 categories = models.CharField(max_length=255, blank=True)
83 departments = models.ManyToManyField('Department', blank=True)83 departments = models.ManyToManyField('Department', blank=True)
84 icon_name = models.CharField(max_length=255, blank=True)84 icon_name = models.CharField(max_length=255, blank=True)
85 icon = models.ImageField(upload_to='icons/%Y/%m', max_length=200,85 icon = models.ImageField(
86 null=True, blank=True)86 upload_to='icons/%Y/%m', max_length=200, null=True, blank=True)
87 for_purchase = models.BooleanField(default=False)87 for_purchase = models.BooleanField(default=False)
88 archive_id = models.CharField(max_length=64, null=True,88 archive_id = models.CharField(
89 db_index=True, blank=True)89 max_length=64, null=True, db_index=True, blank=True)
90 price = models.DecimalField(max_digits=7, decimal_places=2, null=True,90 price = models.DecimalField(
91 max_digits=7, decimal_places=2, null=True,
91 blank=True, help_text="For-purchase applications (in US Dollars).")92 blank=True, help_text="For-purchase applications (in US Dollars).")
92 application_id = models.IntegerField(null=True, blank=True)93 application_id = models.IntegerField(null=True, blank=True)
9394
94 ratings_total = models.IntegerField(null=True, blank=True)95 ratings_total = models.IntegerField(null=True, blank=True)
95 ratings_average = models.DecimalField(max_digits=3, decimal_places=2,96 ratings_average = models.DecimalField(
96 null=True, blank=True)97 max_digits=3, decimal_places=2, null=True, blank=True)
97 ratings_histogram = models.CharField(max_length=128, blank=True)98 ratings_histogram = models.CharField(max_length=128, blank=True)
98 is_latest = models.BooleanField()99 is_latest = models.BooleanField()
99 wilson_score = models.FloatField(null=True, blank=True, db_index=True)100 wilson_score = models.FloatField(null=True, blank=True, db_index=True)
@@ -154,7 +155,7 @@
154 name=dept_name, defaults={'slug': slugify(dept_name)})155 name=dept_name, defaults={'slug': slugify(dept_name)})
155 if created:156 if created:
156 logging.warn("Department %s automatically created!" %157 logging.warn("Department %s automatically created!" %
157 dept_name)158 dept_name)
158 self.departments.add(dept)159 self.departments.add(dept)
159 break160 break
160161
@@ -164,8 +165,9 @@
164 crumbs = depts[0].crumbs(distro=self.distroseries.code_name)165 crumbs = depts[0].crumbs(distro=self.distroseries.code_name)
165 else:166 else:
166 crumbs = [{'name': 'All Apps', 'url': reverse('wc-index')}]167 crumbs = [{'name': 'All Apps', 'url': reverse('wc-index')}]
167 crumbs.append({'name': self.name, 'url': reverse('wc-package-detail',168 url = reverse('wc-package-detail',
168 args=[self.distroseries.code_name, self.package_name])})169 args=[self.distroseries.code_name, self.package_name])
170 crumbs.append({'name': self.name, 'url': url})
169 return crumbs171 return crumbs
170172
171 def license_type(self):173 def license_type(self):
@@ -198,7 +200,7 @@
198 ('icon_128', 'Icon 128x128'),200 ('icon_128', 'Icon 128x128'),
199 ('screenshot', 'Screenshot'),201 ('screenshot', 'Screenshot'),
200 ('video', 'Video'),202 ('video', 'Video'),
201 )203 )
202204
203 application = models.ForeignKey(Application)205 application = models.ForeignKey(Application)
204 media_type = models.CharField(max_length=16, choices=MEDIA_CHOICES)206 media_type = models.CharField(max_length=16, choices=MEDIA_CHOICES)
@@ -268,7 +270,7 @@
268 published = models.BooleanField()270 published = models.BooleanField()
269 display = models.NullBooleanField(271 display = models.NullBooleanField(
270 help_text="Yes: Always display. No: Never display. "272 help_text="Yes: Always display. No: Never display. "
271 "Unknown: Display if published")273 "Unknown: Display if published")
272 weight = models.IntegerField(default=0)274 weight = models.IntegerField(default=0)
273275
274 class Meta:276 class Meta:
@@ -281,7 +283,7 @@
281 if not pkg_name:283 if not pkg_name:
282 return ''284 return ''
283 return reverse('wc-package-detail',285 return reverse('wc-package-detail',
284 kwargs={'package_name': pkg_name})286 kwargs={'package_name': pkg_name})
285287
286 return reverse('wc-package-list') + '?' + '&'.join(288 pkgs = '&'.join('pkg_name=%s' % pkg_name for pkg_name in pkg_names)
287 ['pkg_name=%s' % pkg_name for pkg_name in pkg_names])289 return reverse('wc-package-list') + '?' + pkgs
288290
=== modified file 'src/webcatalog/models/oauthtoken.py'
--- src/webcatalog/models/oauthtoken.py 2012-01-06 17:54:47 +0000
+++ src/webcatalog/models/oauthtoken.py 2012-06-06 16:45:24 +0000
@@ -24,7 +24,7 @@
24 'Consumer',24 'Consumer',
25 'Nonce',25 'Nonce',
26 'DataStore',26 'DataStore',
27 ]27]
2828
29import os.path29import os.path
30import random30import random
@@ -45,9 +45,7 @@
4545
4646
47def _set_seed():47def _set_seed():
48 if (not hasattr(_set_seed, 'seed') and48 if (not hasattr(_set_seed, 'seed') and os.path.exists("/dev/random")):
49 os.path.exists("/dev/random")):
50
51 data = open("/dev/random").read(struct.calcsize('Q'))49 data = open("/dev/random").read(struct.calcsize('Q'))
52 random.seed(struct.unpack('Q', data))50 random.seed(struct.unpack('Q', data))
53 _set_seed.seed = True51 _set_seed.seed = True
@@ -92,7 +90,8 @@
9290
93 key = models.CharField(max_length=64)91 key = models.CharField(max_length=64)
9492
95 secret = models.CharField(max_length=255, blank=True, null=False,93 secret = models.CharField(
94 max_length=255, blank=True, null=False,
96 default=partial(generate_random_string, CONSUMER_SECRET_LENGTH))95 default=partial(generate_random_string, CONSUMER_SECRET_LENGTH))
9796
98 created_at = models.DateTimeField(auto_now_add=True)97 created_at = models.DateTimeField(auto_now_add=True)
9998
=== modified file 'src/webcatalog/templatetags/webcatalog.py'
--- src/webcatalog/templatetags/webcatalog.py 2012-03-12 20:14:34 +0000
+++ src/webcatalog/templatetags/webcatalog.py 2012-06-06 16:45:24 +0000
@@ -20,12 +20,12 @@
20from __future__ import (20from __future__ import (
21 absolute_import,21 absolute_import,
22 with_statement,22 with_statement,
23 )23)
2424
25__metaclass__ = type25__metaclass__ = type
26__all__ = [26__all__ = [
27 'install_options',27 'install_options',
28 ]28]
2929
30import string30import string
3131
@@ -198,4 +198,4 @@
198 stars.append(0)198 stars.append(0)
199199
200 return dict(stars=stars, total=num_ratings,200 return dict(stars=stars, total=num_ratings,
201 STATIC_URL=settings.STATIC_URL, size=size)201 STATIC_URL=settings.STATIC_URL, size=size)

Subscribers

People subscribed via source and target branches