Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial generator

  • Loading branch information...
commit f3348e01dc736d027831df6fe34c299192dc478b 0 parents
@jlongster jlongster authored
2  .gitignore
@@ -0,0 +1,2 @@
+*.pyc
+relnotes.sqlite
0  __init__.py
No changes.
1  requirements/compiled.txt
@@ -0,0 +1 @@
+Jinja2==2.5.5
79 run.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+import sqlite3
+import jinja2
+
+conn = sqlite3.connect('relnotes.sqlite')
+c = conn.cursor()
+
+product_name = 'Firefox'
+version = None
+channel_name = None
+
+c.execute('SELECT id, product_text FROM Products WHERE product_name=? LIMIT 1', (product_name,))
+(product_id, product_text) = c.fetchone()
+
+if not version:
+ c.execute('SELECT version FROM Releases WHERE product=? ORDER BY release_date DESC LIMIT 1',
+ (product_id,))
+ (version,) = c.fetchone() or (None,)
+
+if not channel_name:
+ c.execute('SELECT c.channel_name FROM Releases r '
+ 'LEFT OUTER JOIN Channels c ON r.channel=c.id '
+ 'WHERE product=? AND version=? '
+ 'ORDER BY release_date DESC LIMIT 1',
+ (product_id, version))
+ (channel_name,) = c.fetchone() or (None,)
+
+c.execute('SELECT id FROM Channels WHERE channel_name=? LIMIT 1',
+ (channel_name,))
+(channel_id,) = c.fetchone() or (None,)
+
+c.execute('SELECT sub_version, release_date, release_text FROM Releases '
+ 'WHERE product=? AND version=? AND channel=? '
+ 'ORDER BY release_date DESC LIMIT 1',
+ (product_id, version, channel_id))
+(sub_version, release_date, release_text) = c.fetchone() or (None, None, None)
+
+version_text = 'v.%s.0%s' % (version, '.%s' % sub_version if sub_version else '')
+
+c.execute('SELECT Notes.description, Tags.tag_text FROM Notes '
+ 'LEFT OUTER JOIN Tags ON Notes.tag=Tags.id '
+ 'WHERE bug_num IS NULL AND '
+ '(product IS NULL OR product=?) AND '
+ 'fixed_in_version=? AND '
+ '(fixed_in_channel IS NULL OR fixed_in_channel<=?) '
+ 'ORDER BY Tags.sort_num ASC, Notes.sort_num DESC',
+ (product_id, version, channel_id))
+whats_new = c.fetchall()
+
+c.execute('SELECT bug_num,description FROM Notes '
+ 'WHERE bug_num IS NOT NULL AND '
+ '(product IS NULL OR product=?) AND '
+ 'fixed_in_version=? AND '
+ '(fixed_in_channel IS NULL OR fixed_in_channel<=?) '
+ 'ORDER BY sort_num DESC',
+ (product_id, version, channel_id))
+fixed = c.fetchall()
+
+c.execute('SELECT Notes.bug_num, Notes.description, Notes.fixed_in_version, '
+ ' Notes.fixed_in_channel, Channels.channel_name FROM Notes '
+ 'LEFT OUTER JOIN Channels ON Notes.fixed_in_channel=Channels.id '
+ 'WHERE bug_num IS NOT NULL AND '
+ '(product IS NULL OR product=?) AND '
+ '(first_version<? OR '
+ ' (first_version=? AND '
+ ' (first_channel IS NULL OR first_channel<=?))) AND '
+ '(fixed_in_version IS NULL OR fixed_in_version>? OR '
+ ' (fixed_in_version=? AND '
+ ' (fixed_in_channel IS NULL OR fixed_in_channel>?))) '
+ 'ORDER BY sort_num DESC',
+ (product_id, version, version, channel_id, version, version, channel_id))
+known_issues = c.fetchall()
+
+env = jinja2.Environment(loader=jinja2.FileSystemLoader('templates'))
+tmpl = env.get_template('aurora.html')
+print tmpl.render({'whats_new': whats_new,
+ 'fixed': fixed,
+ 'known_issues': known_issues}).encode('utf-8')
132 templates/aurora.html
@@ -0,0 +1,132 @@
+<?php
+ $page_title = 'Firefox Aurora Notes';
+ $body_id = 'aurora-relnotes';
+ $body_class = 'darkbg';
+$fonts = <<<FONTS
+ <style>
+ @font-face {
+ font-family: 'MuseoSans';
+ src: url('{$config['static_prefix']}/img/fonts/MuseoSans_500-webfont.eot');
+ src: url('{$config['static_prefix']}/img/fonts/MuseoSans_500-webfont.eot?iefix') format('eot'),
+ url('{$config['static_prefix']}/img/fonts/MuseoSans_500-webfont.woff') format('woff'),
+ url('{$config['static_prefix']}/img/fonts/MuseoSans_500-webfont.ttf') format('truetype'),
+ url('{$config['static_prefix']}/img/fonts/MuseoSans_500-webfont.svg#webfont') format('svg');
+ }
+ </style>
+FONTS;
+
+ $extra_headers = <<<EXTRA_HEADERS
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,800,800italic,700italic' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="{$config['static_prefix']}/style/covehead/aurora-releasenotes.css" media="screen" />
+EXTRA_HEADERS;
+ include_once "{$config['file_root']}/{$lang}/includes/header.inc.php";
+
+?>
+
+<div id="main-feature">
+ <div id="relnoteswitcher">
+ <h4>View notes for:</h4>
+ <ul>
+ <li><span>Desktop</span></li>
+ <li><a href="#">Mobile</a></li>
+ </ul>
+ </div>
+ <h2>
+ <img src="<?=$config['static_prefix']?>/img/covehead/firefox/aurora/relnotes/title.png" alt="Firefox Aurora" height="51" width="346" />
+ Notes <small>(First offered to Aurora channel users on November 8th, 2011)</small>
+ </h2>
+ <p>Check out what’s below, and find answers to frequently asked questions. As always, you’re encouraged to <a href="#">tell us what you think</a>, or file a bug in <a href="#">Bugzilla</a>.</p>
+</div>
+
+<div id="main-content">
+
+ <section id="whatsnew">
+ <h3>What’s New</h3>
+ <div class="section-contents">
+ <ul>
+ {% for item in whats_new %}
+ <li>
+ <span class="tag tag-{{ item[1]|lower }}">{{ item[1] }}</span>
+ <!-- The description is the title for now -->
+ <h5>{{ item[0] }}</h5>
+ <!-- <p></p> -->
+ </li>
+ {% endfor %}
+
+
+ {% for item in fixed %}
+ <li>
+ <span class="tag tag-fixed">FIXED</span>
+ <h5>
+ {{ item[1] }}
+ (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id={{ item[0] }}">{{ item[0] }}</a>)
+ </h5>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ </section>
+
+ <section id="knownisues">
+ <h3>Known Issues</h3>
+ <div class="section-contents">
+ <ul>
+ <li>
+ <span class="tag tag-resolved">Resolved</span>
+ <h5>Lorem ipsum dolor sit</h5>
+ <p>Amet, consectetur adipiscing elit. Nullam tellus odio, gravida vitae convallis quis, euismod nec metus.</p>
+ </li>
+ <li>
+ <span class="tag tag-unresolved">Unresolved</span>
+ <h5>Lorem ipsum dolor sit</h5>
+ <p>Amet, consectetur adipiscing elit. Nullam tellus odio, gravida vitae convallis quis, euismod nec metus.</p>
+ </li>
+ </ul>
+ </div>
+ </section>
+
+</div><!-- end #main-content div -->
+
+<div id="sidebar">
+
+ <section id="try">
+ <h3>Try Firefox Aurora</h3>
+ <ol>
+ <li>Check</li>
+ <li>Download</li>
+ <li>Install</li>
+ <li>Customize</li>
+ </ol>
+ </section>
+
+ <section id="get-involved">
+ <h3>Want to get involved?</h3>
+ <p>Did you know that most of the contention Firefox Support was written by volunteers?</p>
+ <a href="#">Find out more »</a>
+ </section>
+
+
+ <section id="problems">
+ <h3>Having Problems?</h3>
+ <ol>
+ <li><a href="#">Give us feedback on your experience with Aurora »</a> [dev only]</li>
+ <li><a href="#">Search for answers on the Firefox Support page »</a></li>
+ <li><a href="#">Look at the known issues list and see if we already know about the problem »</a> [dev only]</li>
+ <li><a href="#">If you can’t find reference to your issue, please consider filing a technical bug report »</a> [dev only]</li>
+ </ol>
+ </section>
+
+
+ <section id="other">
+ <h3>Other Resources</h3>
+ <p><a href="#">Firefox Support page »</a></p>
+ <p><a href="#">Developer Informatio »</a></p>
+ <p><a href="#">Future of Firefox Blog »</a></p>
+ </section>
+
+</div>
+
+<?php
+ @include_once "{$config['file_root']}/{$lang}/includes/footer.inc.php";
+?>
+
Please sign in to comment.
Something went wrong with that request. Please try again.