Merge lp:~lukasz-czyzykowski/ubuntu-webcatalog/upgrade-to-django-1.5 into lp:ubuntu-webcatalog
- upgrade-to-django-1.5
- Merge into trunk
Proposed by
Łukasz Czyżykowski
Status: | Merged |
---|---|
Approved by: | Łukasz Czyżykowski |
Approved revision: | 199 |
Merged at revision: | 179 |
Proposed branch: | lp:~lukasz-czyzykowski/ubuntu-webcatalog/upgrade-to-django-1.5 |
Merge into: | lp:ubuntu-webcatalog |
Diff against target: |
743 lines (+96/-76) 34 files modified
django_project/config/main.cfg (+4/-5) django_project/urls.py (+4/-3) fabtasks/django.py (+3/-9) setup.py (+3/-2) src/webcatalog/api/__init__.py (+14/-0) src/webcatalog/api/handlers.py (+7/-0) src/webcatalog/auth.py (+3/-1) src/webcatalog/management/commands/cleanup.py (+3/-0) src/webcatalog/management/commands/import_ratings_stats.py (+4/-2) src/webcatalog/migrations/0015_add_applicationmedia.py (+2/-2) src/webcatalog/migrations/0016_populate_application_media.py (+1/-1) src/webcatalog/models/applications.py (+2/-2) src/webcatalog/schema.py (+1/-3) src/webcatalog/templates/404.html (+1/-1) src/webcatalog/templates/light/index.1col.html (+1/-1) src/webcatalog/templates/webcatalog/app_carousel_widget.html (+2/-2) src/webcatalog/templates/webcatalog/application_detail.html (+7/-7) src/webcatalog/templates/webcatalog/application_list_snippet.html (+2/-2) src/webcatalog/templates/webcatalog/base.html (+3/-3) src/webcatalog/templates/webcatalog/department_overview.html (+1/-1) src/webcatalog/templates/webcatalog/department_overview_snippet.html (+1/-1) src/webcatalog/templates/webcatalog/exhibits_widget.html (+1/-1) src/webcatalog/templates/webcatalog/featured_apps_widget.html (+1/-1) src/webcatalog/templates/webcatalog/index.html (+3/-3) src/webcatalog/templates/webcatalog/recommended_apps_widget.html (+1/-1) src/webcatalog/templates/webcatalog/search_results.html (+1/-1) src/webcatalog/templates/webcatalog/task_list.html (+2/-2) src/webcatalog/templates/webcatalog/top_rated_apps_widget.html (+1/-1) src/webcatalog/tests/factory.py (+3/-1) src/webcatalog/tests/test_commands.py (+10/-8) src/webcatalog/tests/test_preflight.py (+1/-1) src/webcatalog/tests/test_views.py (+1/-1) src/webcatalog/views.py (+2/-2) test_requirements.txt (+0/-5) |
To merge this branch: | bzr merge lp:~lukasz-czyzykowski/ubuntu-webcatalog/upgrade-to-django-1.5 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | Approve | ||
Review via email: mp+158009@code.launchpad.net |
Commit message
Upgrade to Django 1.5.1
Description of the change
Upgrade to Django 1.5.1
To post a comment you must log in.
- 199. By Łukasz Czyżykowski
-
Added comment about _is_string attribute on http responses in the api module.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'django_project/config/main.cfg' |
2 | --- django_project/config/main.cfg 2013-02-28 16:23:58 +0000 |
3 | +++ django_project/config/main.cfg 2013-04-15 13:23:28 +0000 |
4 | @@ -37,6 +37,9 @@ |
5 | webcatalog.middleware.exception.LogExceptionMiddleware |
6 | django.middleware.cache.FetchFromCacheMiddleware |
7 | fixture_dirs = |
8 | +template_loaders = django.template.loaders.filesystem.Loader |
9 | + django.template.loaders.app_directories.Loader |
10 | + django.template.loaders.eggs.Loader |
11 | |
12 | secret_key = eepu9Av5ixage9ahhodovahfaiFoorodahf6keip3eichaeW9f |
13 | template_debug = %(debug)s |
14 | @@ -58,15 +61,11 @@ |
15 | admin_media_prefix = /assets/admin/ |
16 | test_runner = djcelery.contrib.test_runner.CeleryTestSuiteRunner |
17 | |
18 | -# Django-1.1 backwards compatibility |
19 | -database_engine = sqlite3 |
20 | -database_name = webcatalog.db |
21 | - |
22 | [django_databases] |
23 | default = default_database |
24 | |
25 | [default_database] |
26 | -engine = sqlite3 |
27 | +engine = django.db.backends.sqlite3 |
28 | name = webcatalog.db |
29 | |
30 | [django_logging] |
31 | |
32 | === modified file 'django_project/urls.py' |
33 | --- django_project/urls.py 2013-02-28 16:23:58 +0000 |
34 | +++ django_project/urls.py 2013-04-15 13:23:28 +0000 |
35 | @@ -16,11 +16,12 @@ |
36 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
37 | |
38 | import preflight |
39 | -from django.conf.urls.defaults import patterns, include, url |
40 | + |
41 | +from django.conf.urls import patterns, include, url |
42 | from django.conf import settings |
43 | from django.contrib import admin |
44 | from django.contrib.auth.views import logout |
45 | -from django.views.generic.simple import redirect_to |
46 | +from django.views.generic import RedirectView |
47 | |
48 | admin.autodiscover() |
49 | preflight.autodiscover() |
50 | @@ -33,7 +34,7 @@ |
51 | url(r'^cat/', include('webcatalog.urls')), |
52 | url(r'^admin/', include(admin.site.urls)), |
53 | (r'^preflight/$', include('preflight.urls')), |
54 | - url(r'^$', redirect_to, {'url': '/cat/'}), |
55 | + url(r'^$', RedirectView.as_view(url='/cat/')), |
56 | |
57 | # OpenID views |
58 | (r'^openid/', include('django_openid_auth.urls')), |
59 | |
60 | === modified file 'fabtasks/django.py' |
61 | --- fabtasks/django.py 2011-09-12 13:37:24 +0000 |
62 | +++ fabtasks/django.py 2013-04-15 13:23:28 +0000 |
63 | @@ -23,6 +23,7 @@ |
64 | from ConfigParser import ConfigParser |
65 | from xml.etree import ElementTree as et |
66 | |
67 | + |
68 | def manage(command, *args): |
69 | """Run manage.py command""" |
70 | local("virtualenv/bin/python django_project/manage.py {0} {1}".format( |
71 | @@ -34,15 +35,10 @@ |
72 | spec = "webcatalog" |
73 | if pg: |
74 | local("virtualenv/bin/pip install psycopg2==2.4.1") |
75 | - conf = { |
76 | - 'database_name': "uwc", |
77 | - 'database_engine': "postgresql_psycopg2", |
78 | - 'database_user': "postgres", |
79 | - } |
80 | conf_db = { |
81 | - 'engine': "postgresql_psycopg2", |
82 | + 'engine': "django.db.backends.postgresql_psycopg2", |
83 | 'name': "uwc", |
84 | - 'database_user': "postgres" |
85 | + 'user': "postgres" |
86 | } |
87 | conf_file = "django_project/local.cfg" |
88 | parser = ConfigParser() |
89 | @@ -51,8 +47,6 @@ |
90 | parser.read([conf_file]) |
91 | if not parser.has_section('django'): |
92 | parser.add_section('django') |
93 | - for name, value in conf.items(): |
94 | - parser.set('django', name, value) |
95 | if not parser.has_section('default_database'): |
96 | parser.add_section('default_database') |
97 | for name, value in conf_db.items(): |
98 | |
99 | === modified file 'setup.py' |
100 | --- setup.py 2013-02-28 16:23:58 +0000 |
101 | +++ setup.py 2013-04-15 13:23:28 +0000 |
102 | @@ -1,6 +1,7 @@ |
103 | import os |
104 | from setuptools import setup, find_packages |
105 | |
106 | + |
107 | def find_packages_data(start_dir): |
108 | packages = {} |
109 | for package_name in os.listdir(start_dir): |
110 | @@ -35,9 +36,9 @@ |
111 | install_requires = [ |
112 | 'django', |
113 | 'setuptools', |
114 | - 'south==0.7.3', |
115 | + 'south==0.7.6', |
116 | 'configglue==1.0.1', |
117 | - 'django-configglue==0.6.1', |
118 | + 'django-configglue==0.7', |
119 | 'django-openid-auth==0.2', |
120 | 'django-piston==0.2.3', |
121 | 'django-preflight', |
122 | |
123 | === modified file 'src/webcatalog/api/__init__.py' |
124 | --- src/webcatalog/api/__init__.py 2011-09-12 13:37:24 +0000 |
125 | +++ src/webcatalog/api/__init__.py 2013-04-15 13:23:28 +0000 |
126 | @@ -13,3 +13,17 @@ |
127 | # |
128 | # You should have received a copy of the GNU Affero General Public License |
129 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
130 | + |
131 | +# Bit of surgery on pison internals, this fixes |
132 | +# https://github.com/simplejson/simplejson/issues/37 |
133 | + |
134 | +import json |
135 | +import simplejson |
136 | + |
137 | +from piston.utils import Mimer |
138 | +from piston import emitters |
139 | + |
140 | +emitters.simplejson = json |
141 | + |
142 | +Mimer.unregister(simplejson.loads) |
143 | +Mimer.register(json.loads, ('application/json',)) |
144 | |
145 | === modified file 'src/webcatalog/api/handlers.py' |
146 | --- src/webcatalog/api/handlers.py 2012-09-17 15:55:15 +0000 |
147 | +++ src/webcatalog/api/handlers.py 2013-04-15 13:23:28 +0000 |
148 | @@ -41,6 +41,13 @@ |
149 | ) |
150 | from .forms import MachineCreateUpdateForm, MachineUpdatePackagesForm |
151 | |
152 | +# django-piston (outdated bit of software) expects those attributes to |
153 | +# determine if the resonse content is iterator or not. Here we never |
154 | +# use that possibliblit, so hardcoding the attribute. |
155 | +HttpResponse._is_string = True |
156 | +HttpResponseNotFound._is_string = True |
157 | +HttpResponseBadRequest._is_string = True |
158 | + |
159 | |
160 | class ServerStatusHandler(BaseHandler): |
161 | allowed_methods = ('GET',) |
162 | |
163 | === modified file 'src/webcatalog/auth.py' |
164 | --- src/webcatalog/auth.py 2012-06-30 00:09:12 +0000 |
165 | +++ src/webcatalog/auth.py 2013-04-15 13:23:28 +0000 |
166 | @@ -24,6 +24,7 @@ |
167 | __all__ = [ |
168 | 'SSOOAuthAuthentication', |
169 | ] |
170 | +import pytz |
171 | |
172 | from datetime import datetime, timedelta |
173 | from django.conf import settings |
174 | @@ -100,7 +101,8 @@ |
175 | tokens = Token.objects.filter(token=oauthtoken, |
176 | consumer__key=consumer_key) |
177 | if (len(tokens) == 0 or |
178 | - tokens[0].updated_at < datetime.now() - TOKEN_CACHE_EXPIRY): |
179 | + tokens[0].updated_at < ( |
180 | + datetime.now(pytz.utc) - TOKEN_CACHE_EXPIRY)): |
181 | pieces = web_services.get_data_for_account( |
182 | token=oauthtoken, openid_identifier=consumer_key, |
183 | signature=request.get_parameter('oauth_signature')) |
184 | |
185 | === modified file 'src/webcatalog/management/commands/cleanup.py' |
186 | --- src/webcatalog/management/commands/cleanup.py 2012-09-11 14:19:39 +0000 |
187 | +++ src/webcatalog/management/commands/cleanup.py 2013-04-15 13:23:28 +0000 |
188 | @@ -27,6 +27,7 @@ |
189 | |
190 | try: |
191 | import psycopg2 |
192 | + psycopg2 |
193 | psycopg2_available = True |
194 | except ImportError: |
195 | psycopg2_available = False |
196 | @@ -165,6 +166,8 @@ |
197 | batch_size -= batch_size_wobble |
198 | elif actual_batch_time < target_batch_time * 0.9: |
199 | batch_size += batch_size_wobble |
200 | + if batch_size < 1: |
201 | + batch_size = 1 |
202 | |
203 | def output(self, message, level=None, flush=False): |
204 | if hasattr(self, 'stdout'): |
205 | |
206 | === modified file 'src/webcatalog/management/commands/import_ratings_stats.py' |
207 | --- src/webcatalog/management/commands/import_ratings_stats.py 2012-12-03 16:25:55 +0000 |
208 | +++ src/webcatalog/management/commands/import_ratings_stats.py 2013-04-15 13:23:28 +0000 |
209 | @@ -18,6 +18,8 @@ |
210 | """Management command to import review statistics for a distroseries.""" |
211 | |
212 | import json |
213 | +import pytz |
214 | + |
215 | from datetime import ( |
216 | datetime, |
217 | timedelta, |
218 | @@ -87,7 +89,7 @@ |
219 | def update_last_import_timestamp(self, distroseries): |
220 | review_stats_import, created = ReviewStatsImport.objects.get_or_create( |
221 | distroseries=distroseries) |
222 | - review_stats_import.last_import = datetime.utcnow() |
223 | + review_stats_import.last_import = datetime.now(pytz.utc) |
224 | review_stats_import.save() |
225 | |
226 | def download_review_stats(self, distroseries): |
227 | @@ -99,7 +101,7 @@ |
228 | if other_imports: |
229 | stats_import = other_imports[0] |
230 | time_since_last_import = ( |
231 | - datetime.utcnow() - stats_import.last_import) |
232 | + datetime.now(pytz.utc) - stats_import.last_import) |
233 | if time_since_last_import < timedelta(days=1): |
234 | num_days = 1 |
235 | elif time_since_last_import < timedelta(days=3): |
236 | |
237 | === modified file 'src/webcatalog/migrations/0015_add_applicationmedia.py' |
238 | --- src/webcatalog/migrations/0015_add_applicationmedia.py 2012-03-19 08:18:57 +0000 |
239 | +++ src/webcatalog/migrations/0015_add_applicationmedia.py 2013-04-15 13:23:28 +0000 |
240 | @@ -16,7 +16,7 @@ |
241 | self.gf('django.db.models.fields.CharField')(max_length=16)), |
242 | ('url', |
243 | self.gf('django.db.models.fields.URLField')( |
244 | - max_length=200, verify_exists=False)), |
245 | + max_length=200)), |
246 | )) |
247 | db.send_create_signal('webcatalog', ['ApplicationMedia']) |
248 | |
249 | @@ -66,7 +66,7 @@ |
250 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
251 | 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), |
252 | 'url': ('django.db.models.fields.URLField', [], |
253 | - {'max_length': '200', 'verify_exists': 'False'}) |
254 | + {'max_length': '200'}) |
255 | }, |
256 | 'webcatalog.application': { |
257 | 'Meta': {'unique_together': "(('distroseries', 'archive_id'),)", 'object_name': 'Application'}, |
258 | |
259 | === modified file 'src/webcatalog/migrations/0016_populate_application_media.py' |
260 | --- src/webcatalog/migrations/0016_populate_application_media.py 2012-03-19 08:18:57 +0000 |
261 | +++ src/webcatalog/migrations/0016_populate_application_media.py 2013-04-15 13:23:28 +0000 |
262 | @@ -94,7 +94,7 @@ |
263 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
264 | 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), |
265 | 'url': ('django.db.models.fields.URLField', [], |
266 | - {'max_length': '200', 'verify_exists': 'False'}) |
267 | + {'max_length': '200'}) |
268 | }, |
269 | 'webcatalog.consumer': { |
270 | 'Meta': {'object_name': 'Consumer'}, |
271 | |
272 | === modified file 'src/webcatalog/models/applications.py' |
273 | --- src/webcatalog/models/applications.py 2012-09-06 14:07:55 +0000 |
274 | +++ src/webcatalog/models/applications.py 2013-04-15 13:23:28 +0000 |
275 | @@ -226,7 +226,7 @@ |
276 | |
277 | application = models.ForeignKey(Application) |
278 | media_type = models.CharField(max_length=16, choices=MEDIA_CHOICES) |
279 | - url = models.URLField(verify_exists=False) |
280 | + url = models.URLField() |
281 | |
282 | def __unicode__(self): |
283 | return "{0} for {1}".format(self.media_type, self.application) |
284 | @@ -286,7 +286,7 @@ |
285 | sca_id = models.IntegerField() |
286 | package_names = models.CharField(max_length=1024) |
287 | banner_url = models.CharField(max_length=1024) |
288 | - click_url = models.URLField(verify_exists=False, default='') |
289 | + click_url = models.URLField(default='') |
290 | distroseries = models.ManyToManyField(DistroSeries) |
291 | html = models.TextField() |
292 | date_created = models.DateTimeField(auto_now_add=True) |
293 | |
294 | === modified file 'src/webcatalog/schema.py' |
295 | --- src/webcatalog/schema.py 2013-02-28 16:23:58 +0000 |
296 | +++ src/webcatalog/schema.py 2013-04-15 13:23:28 +0000 |
297 | @@ -17,13 +17,11 @@ |
298 | |
299 | """configglue schema for the Apps Directory.""" |
300 | |
301 | - |
302 | -import django |
303 | from configglue import schema |
304 | from django_configglue.schema import schemas |
305 | from oops_dictconfig.configglue_options import OopsOption |
306 | |
307 | -DjangoSchema = schemas.get('1.3.1') |
308 | +DjangoSchema = schemas.get('1.5.1') |
309 | |
310 | |
311 | class WebCatalogSchema(DjangoSchema): |
312 | |
313 | === modified file 'src/webcatalog/templates/404.html' |
314 | --- src/webcatalog/templates/404.html 2012-03-19 15:17:36 +0000 |
315 | +++ src/webcatalog/templates/404.html 2013-04-15 13:23:28 +0000 |
316 | @@ -11,7 +11,7 @@ |
317 | {% block header %}{% endblock %} |
318 | |
319 | {% block head_extra %} |
320 | - <link rel="stylesheet" type="text/css" href="{% url wc-combo %}?light/css/reset.css&light/css/styles.css&light/css/404.css&light/css/forms.css"/> |
321 | + <link rel="stylesheet" type="text/css" href="{% url 'wc-combo' %}?light/css/reset.css&light/css/styles.css&light/css/404.css&light/css/forms.css"/> |
322 | {% endblock %} |
323 | |
324 | {% block content_container %} |
325 | |
326 | === modified file 'src/webcatalog/templates/light/index.1col.html' |
327 | --- src/webcatalog/templates/light/index.1col.html 2012-06-09 02:15:00 +0000 |
328 | +++ src/webcatalog/templates/light/index.1col.html 2013-04-15 13:23:28 +0000 |
329 | @@ -6,7 +6,7 @@ |
330 | <link rel="shortcut icon" href="{{ STATIC_URL }}images/favicon.ico" type="image/x-icon" /> |
331 | <link rel="stylesheet" type="text/css" media="all" href="https://fonts.googleapis.com/css?family=Ubuntu:300,300italic,400,400italic" /> |
332 | {% block head_extra %} |
333 | - <link rel="stylesheet" type="text/css" href="{% url wc-combo %}?light/css/reset.css&light/css/styles.css&light/css/forms.css"/> |
334 | + <link rel="stylesheet" type="text/css" href="{% url 'wc-combo' %}?light/css/reset.css&light/css/styles.css&light/css/forms.css"/> |
335 | {% endblock %} |
336 | </head> |
337 | <body {% block body_extra %}{% endblock %}> |
338 | |
339 | === modified file 'src/webcatalog/templates/webcatalog/app_carousel_widget.html' |
340 | --- src/webcatalog/templates/webcatalog/app_carousel_widget.html 2012-04-19 09:49:41 +0000 |
341 | +++ src/webcatalog/templates/webcatalog/app_carousel_widget.html 2013-04-15 13:23:28 +0000 |
342 | @@ -14,8 +14,8 @@ |
343 | <table class="apps"><tr> |
344 | {% for app in apps %} |
345 | <td{% if forloop.counter|divisibleby:3 %} class="lastcol"{% endif %}> |
346 | - <a href="{% url wc-package-detail package_name=app.package_name %}"><img class="icon64" src="{{ app.icon_url_or_default }}"/></a> |
347 | - <h4><a href="{% url wc-package-detail package_name=app.package_name %}">{{ app.name }}</a></h4> |
348 | + <a href="{% url 'wc-package-detail' package_name=app.package_name %}"><img class="icon64" src="{{ app.icon_url_or_default }}"/></a> |
349 | + <h4><a href="{% url 'wc-package-detail' package_name=app.package_name %}">{{ app.name }}</a></h4> |
350 | <p>{{ app.departments.all.0.name }} | <b>{% if app.price %}${{ app.price }}{% else %}FREE{% endif %}</b></p> |
351 | <p>{{ app.comment }}</p> |
352 | {% if ratings %} |
353 | |
354 | === modified file 'src/webcatalog/templates/webcatalog/application_detail.html' |
355 | --- src/webcatalog/templates/webcatalog/application_detail.html 2012-09-06 10:38:18 +0000 |
356 | +++ src/webcatalog/templates/webcatalog/application_detail.html 2013-04-15 13:23:28 +0000 |
357 | @@ -5,13 +5,13 @@ |
358 | {% block title %}{{ application.name }} — Ubuntu Apps Directory{% endblock %} |
359 | {% block header %}{{ application.name }}{% endblock %} |
360 | {% block head_extra %} |
361 | -<link rel="stylesheet" type="text/css" href="{% url wc-combo %}?light/css/reset.css&light/css/styles.css&css/webcatalog.css&light/css/forms.css&css/carousel.css"/> |
362 | -<script src="{% url wc-combo %}?yui/3.4.0/build/yui/yui-min.js&js/carousel.js&js/screenshots.js"></script> |
363 | +<link rel="stylesheet" type="text/css" href="{% url 'wc-combo' %}?light/css/reset.css&light/css/styles.css&css/webcatalog.css&light/css/forms.css&css/carousel.css"/> |
364 | +<script src="{% url 'wc-combo' %}?yui/3.4.0/build/yui/yui-min.js&js/carousel.js&js/screenshots.js"></script> |
365 | <script> |
366 | -YUI({combine: true, comboBase: '{% url wc-combo %}?', root: 'yui/3.4.0/build/'}).use('io-base', 'node-base', function (Y) { |
367 | +YUI({combine: true, comboBase: '{% url 'wc-combo' %}?', root: 'yui/3.4.0/build/'}).use('io-base', 'node-base', function (Y) { |
368 | |
369 | // XXX michaeln 2011-09-16 bug=851660 Autoload further batches of results. |
370 | - var reviews_uri = "{% url wc-package-reviews-ajax application.distroseries.code_name application.package_name %}"; |
371 | + var reviews_uri = "{% url 'wc-package-reviews-ajax' application.distroseries.code_name application.package_name %}"; |
372 | Y.io(reviews_uri, { |
373 | on: { |
374 | complete: function(id, response){ |
375 | @@ -25,7 +25,7 @@ |
376 | }); |
377 | var recommends_div = Y.one('.portlet.recommendedportlet'); |
378 | if (recommends_div){ |
379 | - var recommendations_uri = "{% url wc-package-recommends application.package_name %}"; |
380 | + var recommendations_uri = "{% url 'wc-package-recommends' application.package_name %}"; |
381 | Y.io(recommendations_uri, { |
382 | on: { |
383 | complete: function(id, response){ |
384 | @@ -59,7 +59,7 @@ |
385 | {% ifequal distroseries.code_name requested_series_codename %} |
386 | <span>{% include "webcatalog/distroseries_snippet.html" %}</span> |
387 | {% else %} |
388 | - <a href="{% url wc-package-detail distroseries.code_name application.package_name %}">{% include "webcatalog/distroseries_snippet.html" %}</a> |
389 | + <a href="{% url 'wc-package-detail' distroseries.code_name application.package_name %}">{% include "webcatalog/distroseries_snippet.html" %}</a> |
390 | {% endifequal %}</li> |
391 | {% endfor %} |
392 | </ul> |
393 | @@ -142,7 +142,7 @@ |
394 | <div class="reviews"> |
395 | <h2>{% trans "Reviews" %}</h2> |
396 | <div id="reviews_placeholder"> |
397 | - <a href="{% url wc-package-reviews application.distroseries.code_name application.package_name %}"> |
398 | + <a href="{% url 'wc-package-reviews' application.distroseries.code_name application.package_name %}"> |
399 | {% blocktrans %}View the reviews for this app{% endblocktrans %}</a> |
400 | </div> |
401 | </div> |
402 | |
403 | === modified file 'src/webcatalog/templates/webcatalog/application_list_snippet.html' |
404 | --- src/webcatalog/templates/webcatalog/application_list_snippet.html 2012-05-08 06:42:38 +0000 |
405 | +++ src/webcatalog/templates/webcatalog/application_list_snippet.html 2013-04-15 13:23:28 +0000 |
406 | @@ -4,11 +4,11 @@ |
407 | <tr> |
408 | <td class="app-icon"> |
409 | |
410 | - <a href="{% if distroseries %}{% url wc-package-detail app.distroseries.code_name app.package_name %}{% else %}{% url wc-package-detail app.package_name %}{% endif %}"><img src="{{ app.icon_url_or_default }}" class="icon32"/></a> |
411 | + <a href="{% if distroseries %}{% url 'wc-package-detail' app.distroseries.code_name app.package_name %}{% else %}{% url 'wc-package-detail' app.package_name %}{% endif %}"><img src="{{ app.icon_url_or_default }}" class="icon32"/></a> |
412 | </td> |
413 | <td class="app-description"> |
414 | <h3> |
415 | - <a href="{% if distroseries %}{% url wc-package-detail app.distroseries.code_name app.package_name %}{% else %}{% url wc-package-detail app.package_name %}{% endif %}">{{ app.name }}</a> |
416 | + <a href="{% if distroseries %}{% url 'wc-package-detail' app.distroseries.code_name app.package_name %}{% else %}{% url 'wc-package-detail' app.package_name %}{% endif %}">{{ app.name }}</a> |
417 | </h3> |
418 | <p>{{ app.comment }}</p> |
419 | </td> |
420 | |
421 | === modified file 'src/webcatalog/templates/webcatalog/base.html' |
422 | --- src/webcatalog/templates/webcatalog/base.html 2012-06-28 14:27:43 +0000 |
423 | +++ src/webcatalog/templates/webcatalog/base.html 2013-04-15 13:23:28 +0000 |
424 | @@ -4,12 +4,12 @@ |
425 | {% block menus %}{% endblock %} |
426 | |
427 | {% block head_extra %} |
428 | - <link rel="stylesheet" type="text/css" href="{% url wc-combo %}?light/css/reset.css&light/css/styles.css&css/webcatalog.css&light/css/forms.css"/> |
429 | + <link rel="stylesheet" type="text/css" href="{% url 'wc-combo' %}?light/css/reset.css&light/css/styles.css&css/webcatalog.css&light/css/forms.css"/> |
430 | {% endblock %} |
431 | |
432 | {% block search %} |
433 | <div id="search-box"> |
434 | - <form id="sitesearch" action="{% url wc-search %}" method="get"> |
435 | + <form id="sitesearch" action="{% url 'wc-search' %}" method="get"> |
436 | <input type="text" maxlength="128" name="q" id="search-box-input" |
437 | placeholder="Search for an app" title="Add some words that describe the app or the app's name." |
438 | /> |
439 | @@ -22,7 +22,7 @@ |
440 | <div class="footer-div"> |
441 | <p class="footer-title">Legal</p> |
442 | <ul> |
443 | - <li><a href="{% url wc-tos %}">Terms of Service</a></li> |
444 | + <li><a href="{% url 'wc-tos' %}">Terms of Service</a></li> |
445 | <li><a href="https://one.ubuntu.com/privacy/">Privacy Policy</a></li> |
446 | </ul> |
447 | </div> |
448 | |
449 | === modified file 'src/webcatalog/templates/webcatalog/department_overview.html' |
450 | --- src/webcatalog/templates/webcatalog/department_overview.html 2012-05-08 06:42:38 +0000 |
451 | +++ src/webcatalog/templates/webcatalog/department_overview.html 2013-04-15 13:23:28 +0000 |
452 | @@ -26,7 +26,7 @@ |
453 | {% ifequal ds.code_name distroseries %} |
454 | <span>Ubuntu {{ ds.version }} ({{ ds.code_name }})</span> |
455 | {% else %} |
456 | - <a href="{% url wc-department distro=ds.code_name dept_slug_or_id=dept.slug %}">Ubuntu {{ ds.version }} ({{ ds.code_name }})</a> |
457 | + <a href="{% url 'wc-department' distro=ds.code_name dept_slug_or_id=dept.slug %}">Ubuntu {{ ds.version }} ({{ ds.code_name }})</a> |
458 | {% endifequal %}</li> |
459 | {% endfor %} |
460 | </ul> |
461 | |
462 | === modified file 'src/webcatalog/templates/webcatalog/department_overview_snippet.html' |
463 | --- src/webcatalog/templates/webcatalog/department_overview_snippet.html 2012-04-05 01:09:37 +0000 |
464 | +++ src/webcatalog/templates/webcatalog/department_overview_snippet.html 2013-04-15 13:23:28 +0000 |
465 | @@ -1,5 +1,5 @@ |
466 | <li class="department"> |
467 | - <a href="{% url wc-department dept_slug_or_id=dept.slug %}"> |
468 | + <a href="{% url 'wc-department' dept_slug_or_id=dept.slug %}"> |
469 | <div class="dept-icon"> |
470 | <img width="24" height="24" |
471 | src="{{ STATIC_URL }}images/dept_icons/{{ dept.slug }}.png"/> |
472 | |
473 | === modified file 'src/webcatalog/templates/webcatalog/exhibits_widget.html' |
474 | --- src/webcatalog/templates/webcatalog/exhibits_widget.html 2012-08-21 13:47:14 +0000 |
475 | +++ src/webcatalog/templates/webcatalog/exhibits_widget.html 2013-04-15 13:23:28 +0000 |
476 | @@ -20,7 +20,7 @@ |
477 | </div> |
478 | </div> |
479 | <script type="text/javascript"> |
480 | -YUI({combine: true, comboBase: '{% url wc-combo %}?', root: 'yui/3.4.0/build/'}).use('uwc-carousel', function(Y) { |
481 | +YUI({combine: true, comboBase: '{% url 'wc-combo' %}?', root: 'yui/3.4.0/build/'}).use('uwc-carousel', function(Y) { |
482 | var caro = new Y.uwc.Carousel({ |
483 | nodeContainer: "#exhibits-carousel", |
484 | controlsContainer: "#exhibits-carousel", |
485 | |
486 | === modified file 'src/webcatalog/templates/webcatalog/featured_apps_widget.html' |
487 | --- src/webcatalog/templates/webcatalog/featured_apps_widget.html 2012-04-18 15:15:56 +0000 |
488 | +++ src/webcatalog/templates/webcatalog/featured_apps_widget.html 2013-04-15 13:23:28 +0000 |
489 | @@ -6,7 +6,7 @@ |
490 | {% endwith %} |
491 | </div> |
492 | <script type="text/javascript"> |
493 | -YUI({combine: true, comboBase: '{% url wc-combo %}?', root: 'yui/3.4.0/build/'}).use('uwc-carousel', function(Y) { |
494 | +YUI({combine: true, comboBase: '{% url 'wc-combo' %}?', root: 'yui/3.4.0/build/'}).use('uwc-carousel', function(Y) { |
495 | var caro = new Y.uwc.Carousel({ |
496 | nodeContainer: "#featured-carousel .carousel", |
497 | controlsContainer: "#featured-carousel .carousel-controls", |
498 | |
499 | === modified file 'src/webcatalog/templates/webcatalog/index.html' |
500 | --- src/webcatalog/templates/webcatalog/index.html 2012-04-18 10:38:33 +0000 |
501 | +++ src/webcatalog/templates/webcatalog/index.html 2013-04-15 13:23:28 +0000 |
502 | @@ -6,8 +6,8 @@ |
503 | {% block search %}{% endblock %} |
504 | |
505 | {% block head_extra %} |
506 | - <link rel="stylesheet" type="text/css" href="{% url wc-combo %}?light/css/reset.css&light/css/styles.css&css/webcatalog.css&light/css/forms.css&css/carousel.css"/> |
507 | - <script src="{% url wc-combo %}?yui/3.4.0/build/yui/yui-min.js&js/carousel.js"></script> |
508 | + <link rel="stylesheet" type="text/css" href="{% url 'wc-combo' %}?light/css/reset.css&light/css/styles.css&css/webcatalog.css&light/css/forms.css&css/carousel.css"/> |
509 | + <script src="{% url 'wc-combo' %}?yui/3.4.0/build/yui/yui-min.js&js/carousel.js"></script> |
510 | {% endblock %} |
511 | |
512 | |
513 | @@ -35,7 +35,7 @@ |
514 | <h3>{% trans "Search for an app" %}:</h3> |
515 | |
516 | <div id="search-box" class="main"> |
517 | - <form id="sitesearch" action="{% url wc-search %}" method="get"> |
518 | + <form id="sitesearch" action="{% url 'wc-search' %}" method="get"> |
519 | <input type="text" maxlength="128" name="q" id="search-box-input" |
520 | title="Add some words that describe the app or the app's name."/> |
521 | <button type="submit" name="op" id="search-box-button"><span>go</span></button> |
522 | |
523 | === modified file 'src/webcatalog/templates/webcatalog/recommended_apps_widget.html' |
524 | --- src/webcatalog/templates/webcatalog/recommended_apps_widget.html 2012-04-20 18:33:58 +0000 |
525 | +++ src/webcatalog/templates/webcatalog/recommended_apps_widget.html 2013-04-15 13:23:28 +0000 |
526 | @@ -4,7 +4,7 @@ |
527 | <ul class="portletactions"> |
528 | {% for app in recommended_apps %} |
529 | <li> |
530 | - <a href="{% url wc-package-detail package_name=app.package_name %}"> |
531 | + <a href="{% url 'wc-package-detail' package_name=app.package_name %}"> |
532 | <div class="top-rated-stars"> |
533 | {% rating_summary app.ratings_average 'small' app.ratings_total %} |
534 | </div> |
535 | |
536 | === modified file 'src/webcatalog/templates/webcatalog/search_results.html' |
537 | --- src/webcatalog/templates/webcatalog/search_results.html 2012-05-08 06:42:38 +0000 |
538 | +++ src/webcatalog/templates/webcatalog/search_results.html 2013-04-15 13:23:28 +0000 |
539 | @@ -15,7 +15,7 @@ |
540 | {% ifequal ds.code_name distroseries %} |
541 | <span>Ubuntu {{ ds.version }} ({{ ds.code_name }})</span> |
542 | {% else %} |
543 | - <a href="{% url wc-search ds.code_name %}?q={{query}}">Ubuntu {{ ds.version }} ({{ ds.code_name }})</a> |
544 | + <a href="{% url 'wc-search' ds.code_name %}?q={{query}}">Ubuntu {{ ds.version }} ({{ ds.code_name }})</a> |
545 | {% endifequal %}</li> |
546 | {% endfor %} |
547 | </ul> |
548 | |
549 | === modified file 'src/webcatalog/templates/webcatalog/task_list.html' |
550 | --- src/webcatalog/templates/webcatalog/task_list.html 2012-06-29 19:51:06 +0000 |
551 | +++ src/webcatalog/templates/webcatalog/task_list.html 2013-04-15 13:23:28 +0000 |
552 | @@ -5,7 +5,7 @@ |
553 | {% block header %}{% trans "Schedule asynchronous tasks" %}{% endblock %} |
554 | {% block head_extra %} |
555 | {{ block.super }} |
556 | -<script src="{% url wc-combo %}?yui/3.4.0/build/yui/yui-min.js"></script> |
557 | +<script src="{% url 'wc-combo' %}?yui/3.4.0/build/yui/yui-min.js"></script> |
558 | <style type="text/css"> |
559 | div.task button { |
560 | width: 200px; |
561 | @@ -22,7 +22,7 @@ |
562 | } |
563 | </style> |
564 | <script> |
565 | -YUI({combine: true, comboBase: '{% url wc-combo %}?', root: 'yui/3.4.0/build/'}).use('io-base', 'node-base', function (Y) { |
566 | +YUI({combine: true, comboBase: '{% url 'wc-combo' %}?', root: 'yui/3.4.0/build/'}).use('io-base', 'node-base', function (Y) { |
567 | var check_status = function(task_id, message) { |
568 | var check_uri = "/cat/task_status/" + task_id + '/'; |
569 | var UNREADY_STATES = ["PENDING", "RECEIVED", "STARTED", "RETRY"]; |
570 | |
571 | === modified file 'src/webcatalog/templates/webcatalog/top_rated_apps_widget.html' |
572 | --- src/webcatalog/templates/webcatalog/top_rated_apps_widget.html 2012-04-18 15:15:56 +0000 |
573 | +++ src/webcatalog/templates/webcatalog/top_rated_apps_widget.html 2013-04-15 13:23:28 +0000 |
574 | @@ -6,7 +6,7 @@ |
575 | {% endwith %} |
576 | </div> |
577 | <script type="text/javascript"> |
578 | -YUI({combine: true, comboBase: '{% url wc-combo %}?', root: 'yui/3.4.0/build/'}).use('uwc-carousel', function(Y) { |
579 | +YUI({combine: true, comboBase: '{% url 'wc-combo' %}?', root: 'yui/3.4.0/build/'}).use('uwc-carousel', function(Y) { |
580 | var caro = new Y.uwc.Carousel({ |
581 | nodeContainer: "#top-rated-carousel .carousel", |
582 | controlsContainer: "#top-rated-carousel .carousel-controls", |
583 | |
584 | === modified file 'src/webcatalog/tests/factory.py' |
585 | --- src/webcatalog/tests/factory.py 2012-09-06 10:08:33 +0000 |
586 | +++ src/webcatalog/tests/factory.py 2013-04-15 13:23:28 +0000 |
587 | @@ -20,6 +20,8 @@ |
588 | from __future__ import absolute_import |
589 | |
590 | import os |
591 | +import pytz |
592 | + |
593 | from datetime import ( |
594 | datetime, |
595 | timedelta, |
596 | @@ -244,7 +246,7 @@ |
597 | def make_session(self, expire_date=None): |
598 | if expire_date is None: |
599 | secs = self.get_unique_integer() |
600 | - expire_date = datetime.now() + timedelta(seconds=secs) |
601 | + expire_date = datetime.now(pytz.utc) + timedelta(seconds=secs) |
602 | return Session.objects.create( |
603 | session_key=self.get_unique_string(prefix='key-'), |
604 | session_data=self.get_unique_string(prefix='session-data-'), |
605 | |
606 | === modified file 'src/webcatalog/tests/test_commands.py' |
607 | --- src/webcatalog/tests/test_commands.py 2013-02-18 21:55:09 +0000 |
608 | +++ src/webcatalog/tests/test_commands.py 2013-04-15 13:23:28 +0000 |
609 | @@ -22,8 +22,10 @@ |
610 | import apt |
611 | import json |
612 | import os |
613 | +import pytz |
614 | import shutil |
615 | import tempfile |
616 | + |
617 | from datetime import ( |
618 | datetime, |
619 | timedelta, |
620 | @@ -760,7 +762,7 @@ |
621 | |
622 | def test_updates_last_import_record(self): |
623 | onion = self.factory.make_distroseries(code_name='onion') |
624 | - orig_timestamp = datetime(2011, 07, 18, 14, 43) |
625 | + orig_timestamp = datetime(2011, 07, 18, 14, 43, tzinfo=pytz.utc) |
626 | ReviewStatsImport.objects.create( |
627 | distroseries=onion, last_import=orig_timestamp) |
628 | |
629 | @@ -784,7 +786,7 @@ |
630 | # If there has been a recent import, we'll only grab the |
631 | # relevant stats. |
632 | onion = self.factory.make_distroseries(code_name='onion') |
633 | - orig_timestamp = datetime.utcnow() - timedelta(2) |
634 | + orig_timestamp = datetime.now(pytz.utc) - timedelta(2) |
635 | ReviewStatsImport.objects.create( |
636 | distroseries=onion, last_import=orig_timestamp) |
637 | |
638 | @@ -797,8 +799,8 @@ |
639 | # If the download_all option is used, all stats are |
640 | # downloaded, rather than the optimised last X days. |
641 | onion = self.factory.make_distroseries(code_name='onion') |
642 | - orig_timestamp = datetime.utcnow() - timedelta(2) |
643 | - import_record = ReviewStatsImport.objects.create( |
644 | + orig_timestamp = datetime.now(pytz.utc) - timedelta(2) |
645 | + ReviewStatsImport.objects.create( |
646 | distroseries=onion, last_import=orig_timestamp) |
647 | |
648 | call_command('import_ratings_stats', 'onion', download_all=True) |
649 | @@ -1093,12 +1095,12 @@ |
650 | All done. |
651 | ''' |
652 | actual_output = ''.join( |
653 | - str(call[0][0]) for call in self.mock_stdout.write.call_args_list) |
654 | + str(c[0][0]) for c in self.mock_stdout.write.call_args_list) |
655 | self.assertEqual(expected_output, actual_output) |
656 | |
657 | @skipUnless(connection.vendor == 'postgresql', "Requires postgresql") |
658 | def test_cleanup_nonces(self): |
659 | - now = datetime.now() |
660 | + now = datetime.now(pytz.utc) |
661 | for i in range(8): |
662 | created_at = now - timedelta(seconds=5000 * i) |
663 | self.factory.make_nonce(created_at=created_at) |
664 | @@ -1120,7 +1122,7 @@ |
665 | self.check_expected_output() |
666 | |
667 | def create_django_sessions(self): |
668 | - now = datetime.now() |
669 | + now = datetime.now(pytz.utc) |
670 | for i in range(8): |
671 | expire_date = now + timedelta(seconds=5000 * (4 - i)) |
672 | self.factory.make_session(expire_date=expire_date) |
673 | @@ -1131,7 +1133,7 @@ |
674 | |
675 | call_command('cleanup', 'django_session', batch_secs=0) |
676 | |
677 | - self.assertEqual(0, Session.objects.count()) |
678 | + self.assertEqual(4, Session.objects.count()) |
679 | |
680 | |
681 | class ImportAllAppInstallDataTestCase(TestCaseWithFactory): |
682 | |
683 | === modified file 'src/webcatalog/tests/test_preflight.py' |
684 | --- src/webcatalog/tests/test_preflight.py 2012-10-17 07:46:31 +0000 |
685 | +++ src/webcatalog/tests/test_preflight.py 2013-04-15 13:23:28 +0000 |
686 | @@ -85,7 +85,7 @@ |
687 | 'preflight', |
688 | ]) |
689 | expected_checks = set([ |
690 | - ('validate_config', True), |
691 | + ('validate_config', False), |
692 | ('database', True), |
693 | ('rnr_available', True), |
694 | ('identity_provider_available', True), |
695 | |
696 | === modified file 'src/webcatalog/tests/test_views.py' |
697 | --- src/webcatalog/tests/test_views.py 2013-03-01 16:28:52 +0000 |
698 | +++ src/webcatalog/tests/test_views.py 2013-04-15 13:23:28 +0000 |
699 | @@ -399,7 +399,7 @@ |
700 | |
701 | self.assertNotContains(response, |
702 | 'Success. Your download link has been sent.') |
703 | - self.assertContains(response, 'Enter a valid e-mail address.') |
704 | + self.assertContains(response, 'Enter a valid email address.') |
705 | |
706 | def test_version_and_label_displayed(self): |
707 | app = self.factory.make_application( |
708 | |
709 | === modified file 'src/webcatalog/views.py' |
710 | --- src/webcatalog/views.py 2013-03-01 12:49:55 +0000 |
711 | +++ src/webcatalog/views.py 2013-04-15 13:23:28 +0000 |
712 | @@ -109,7 +109,7 @@ |
713 | paginator = Paginator(apps, settings.PAGE_BATCH_SIZE) |
714 | page_num = _get_page_num_from_request(request, paginator) |
715 | |
716 | - context = RequestContext(request, dict={ |
717 | + context = RequestContext(request, { |
718 | 'query': query, |
719 | 'page': paginator.page(page_num), |
720 | 'breadcrumbs': crumbs, |
721 | @@ -140,7 +140,7 @@ |
722 | if len(top_rated) == settings.NUMBER_TOP_RATED_APPS: |
723 | break |
724 | |
725 | - context = RequestContext(request, dict={ |
726 | + context = RequestContext(request, { |
727 | 'depts': depts, |
728 | 'exhibits': exhibits, |
729 | 'featured_apps': featured_apps, |
730 | |
731 | === modified file 'test_requirements.txt' |
732 | --- test_requirements.txt 2012-03-26 16:29:35 +0000 |
733 | +++ test_requirements.txt 2013-04-15 13:23:28 +0000 |
734 | @@ -1,9 +1,4 @@ |
735 | -# django should not be required here, but without it `python setup.py develop` |
736 | -# complains with: |
737 | -# Installed /.../virtualenv/lib/python2.6/site-packages/django_preflight-0.1-py2.6.egg |
738 | -# error: Could not find required distribution django |
739 | -f bzr+http://bazaar.launchpad.net/~elachuni/canonical-identity-provider/ssoclient#egg=ssoclient-1.0 |
740 | -django<1.4 |
741 | coverage |
742 | mock |
743 | piston-mini-client |
12:54 <noodles> Hey there. Just looking at https:/ /code.launchpad .net/~lukasz- czyzykowski/ ubuntu- webcatalog/ upgrade- to-django- 1.5/+merge/ 158009 _is_string = True' around line 152-54 /bitbucket. org/jespern/ django- piston/ pull-requests
12:54 <noodles> Did you have that same piston surgery in the sca branch? I think I saw it and had a thought, but forgot to comment...
12:55 <noodles> Why wouldn't we fix that it piston instead? (I mean, update piston to use json rather than simplejson). Rather than doing patch-work on all of our apps?
12:58 <lukasz> noodles: I did that for all apps
12:58 <lukasz> noodles: patching seemed a quicker way to the end result than fixing piston
12:58 <lukasz> noodles: but I would really like to fix that dead project
13:01 <noodles> Yeah, it sounds quicker initially, but looks like more work in the long run.
13:01 <noodles> Also, what's the private attribute setting for 'HttpResponse.
13:02 <lukasz> another piston backward compatibility
13:03 <noodles> Hrm... do you mean, we could include the fix in an updated piston also?
13:03 <lukasz> it expects this attribute on the response object, and we never return response with iterator content, so that's why it's hardcoded
13:03 <lukasz> noodles: yup
13:03 <noodles> Do you want me to update piston?
13:04 <lukasz> noodles: I can do it, patches for all of the problems are on bitbucket
13:04 <noodles> Ah, sweet.
13:04 <noodles> Ah of course...
13:04 <lukasz> where do we store patched version?
13:04 <noodles> I was thinking we were talking about piston-mini-client (which is easy for us to update)....
13:04 <lukasz> no, that's django-piston
13:04 <noodles> Yeah,
13:05 <lukasz> which needs to be fixed
13:05 <lukasz> https:/
13:05 <noodles> In which case, +1 for your work-arounds, just include a comment on that previous one.
13:05 <noodles> l152-154
13:05 <lukasz> HttpResponse?
13:05 <lukasz> ok