Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add RN template switching to fix Bug 978931 #1748

Merged
merged 1 commit into from

2 participants

@jgmize
Owner

Templates added in this commit are stubs for future use

bedrock/firefox/views.py
@@ -418,9 +418,13 @@ def fix_fx_version(fx_version):
def release_notes_template(channel, product):
- #TODO: if product == 'Firefox OS':
- #TODO: different templates based on channel with default
- return 'firefox/releases/notes.html'
+ if product == 'Firefox OS':
+ return 'firefox/releases/os-notes.html'
+ return 'firefox/releases/%snotes.html' % {
@pmclanahan Owner

I feel like this is sacrificing readability for brevity. I'd much rather see the dict split out. It could even be outside of the function since it doesn't need to be recreated on every call (though that's just a micro-optimization you don't really need to worry about unless you want to).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jgmize
Owner

@pmclanahan I've amended the commit to (hopefully) improve readability based on your feedback.

@jgmize jgmize Add RN template switching to fix Bug 978931
Templates added in this commit are stubs for future use
88530b1
@pmclanahan
Owner

r+ \o/ which is funny b/c this is likely about the same readability (some argue about generator comprehensions) but it uses the values for the channels that already exist, so my efficiency bran loves it :)

@pmclanahan pmclanahan merged commit 0f002ce into from
@jgmize jgmize deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 4, 2014
  1. @jgmize

    Add RN template switching to fix Bug 978931

    jgmize authored
    Templates added in this commit are stubs for future use
This page is out of date. Refresh to see the latest.
View
5 bedrock/firefox/templates/firefox/releases/aurora-notes.html
@@ -0,0 +1,5 @@
+{# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/. #}
+
+{% extends "firefox/releases/release-notes.html" %}
View
5 bedrock/firefox/templates/firefox/releases/beta-notes.html
@@ -0,0 +1,5 @@
+{# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/. #}
+
+{% extends "firefox/releases/release-notes.html" %}
View
5 bedrock/firefox/templates/firefox/releases/esr-notes.html
@@ -0,0 +1,5 @@
+{# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/. #}
+
+{% extends "firefox/releases/release-notes.html" %}
View
5 bedrock/firefox/templates/firefox/releases/nightly-notes.html
@@ -0,0 +1,5 @@
+{# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/. #}
+
+{% extends "firefox/releases/release-notes.html" %}
View
5 bedrock/firefox/templates/firefox/releases/os-notes.html
@@ -0,0 +1,5 @@
+{# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/. #}
+
+{% extends "firefox/releases/release-notes.html" %}
View
0  ...ock/firefox/templates/firefox/releases/notes.html → ...fox/templates/firefox/releases/release-notes.html
File renamed without changes
View
19 bedrock/firefox/tests/test_views.py
@@ -51,7 +51,8 @@ def test_release_notes(self, get_object_or_404):
eq_(self.last_ctx['release'], mock_release)
eq_(self.last_ctx['new_features'], 'mock new_features')
eq_(self.last_ctx['known_issues'], 'mock known_issues')
- eq_(self.mock_render.call_args[0][1], 'firefox/releases/notes.html')
+ eq_(self.mock_render.call_args[0][1],
+ 'firefox/releases/release-notes.html')
@patch('bedrock.firefox.views.get_object_or_404')
def test_system_requirements(self, get_object_or_404):
@@ -67,3 +68,19 @@ def test_system_requirements(self, get_object_or_404):
eq_(self.last_ctx['version'], '27.0.1')
eq_(self.mock_render.call_args[0][1],
'firefox/releases/system_requirements.html')
+
+ def test_release_notes_template(self):
+ eq_(views.release_notes_template('', 'Firefox OS'),
+ 'firefox/releases/os-notes.html')
+ eq_(views.release_notes_template('Nightly', 'Firefox'),
+ 'firefox/releases/nightly-notes.html')
+ eq_(views.release_notes_template('Aurora', 'Firefox'),
+ 'firefox/releases/aurora-notes.html')
+ eq_(views.release_notes_template('Beta', 'Firefox'),
+ 'firefox/releases/beta-notes.html')
+ eq_(views.release_notes_template('Release', 'Firefox'),
+ 'firefox/releases/release-notes.html')
+ eq_(views.release_notes_template('ESR', 'Firefox'),
+ 'firefox/releases/esr-notes.html')
+ eq_(views.release_notes_template('', ''),
+ 'firefox/releases/release-notes.html')
View
7 bedrock/firefox/views.py
@@ -418,9 +418,10 @@ def fix_fx_version(fx_version):
def release_notes_template(channel, product):
- #TODO: if product == 'Firefox OS':
- #TODO: different templates based on channel with default
- return 'firefox/releases/notes.html'
+ if product == 'Firefox OS':
+ return 'firefox/releases/os-notes.html'
+ prefix = dict((c, c.lower()) for c in Release.CHANNELS)
+ return 'firefox/releases/%s-notes.html' % prefix.get(channel, 'release')
def release_notes(request, fx_version, channel='Release', product='Firefox'):
Something went wrong with that request. Please try again.