$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r73197 - in website/public_html/beta/site-tools: boost_site templates
From: dnljms_at_[hidden]
Date: 2011-07-17 15:31:02
Author: danieljames
Date: 2011-07-17 15:31:01 EDT (Sun, 17 Jul 2011)
New Revision: 73197
URL: http://svn.boost.org/trac/boost/changeset/73197
Log:
Website: Only include 'released' versions in feeds.
Created new 'dev.rss' feed so that the latest release note changes can
still be seen in a feed.
Text files modified: 
   website/public_html/beta/site-tools/boost_site/pages.py             |    22 ++++++++++++++++++++--                  
   website/public_html/beta/site-tools/boost_site/settings.py          |    14 +++++++++++---                          
   website/public_html/beta/site-tools/templates/history-template.html |     2 +-                                      
   website/public_html/beta/site-tools/templates/index-src.html        |     2 +-                                      
   website/public_html/beta/site-tools/templates/news-template.html    |     2 +-                                      
   5 files changed, 34 insertions(+), 8 deletions(-)
Modified: website/public_html/beta/site-tools/boost_site/pages.py
==============================================================================
--- website/public_html/beta/site-tools/boost_site/pages.py	(original)
+++ website/public_html/beta/site-tools/boost_site/pages.py	2011-07-17 15:31:01 EDT (Sun, 17 Jul 2011)
@@ -112,11 +112,21 @@
                     { 'page': page_data })
 
     def match_pages(self, patterns, count = None, sort = True):
+        """
+            patterns is a list of strings, containing a glob followed
+            by required flags, separated by '|'. The syntax will probably
+            change in the future.
+        """
         filtered = set()
         for pattern in patterns:
-            filtered = filtered | set(fnmatch.filter(self.pages.keys(), pattern))
+            pattern_parts = pattern.split('|')
+            matches = [x for x in
+                fnmatch.filter(self.pages.keys(), pattern_parts[0])
+                if self.pages[x].is_published(pattern_parts[1:])]
+            filtered = filtered | set(matches)
+
+        entries = [self.pages[x] for x in filtered]
 
-        entries = [self.pages[x] for x in filtered if self.pages[x].page_state != 'new']
         if sort:
             entries = sorted(entries, key = lambda x: x.last_modified, reverse=True)
         if count:
@@ -254,6 +264,14 @@
                 boost_site.util.htmlencode(self.download_item) + \
                 '">Download this release.</a></span></p>';
 
+    def is_published(self, flags):
+        if self.page_state == 'new':
+            return False
+        for flag in flags:
+            if flag not in self.flags:
+                return False
+        return True
+
 def number_suffix(x):
     x = x % 100
     if x / 10 == 1:
Modified: website/public_html/beta/site-tools/boost_site/settings.py
==============================================================================
--- website/public_html/beta/site-tools/boost_site/settings.py	(original)
+++ website/public_html/beta/site-tools/boost_site/settings.py	2011-07-17 15:31:01 EDT (Sun, 17 Jul 2011)
@@ -26,19 +26,27 @@
         'users/news/index.html' : 'site-tools/templates/news-template.html',
         'index.html' : 'site-tools/templates/index-src.html'
     },
+    # See boost_site.pages for matches pattern syntax.
+    #
+    # glob [ '|' flag ]
     'feeds' : {
         'feed/downloads.rss' : {
             'title': 'Boost Downloads',
-            'matches': ['feed/history/*.qbk', 'feed/downloads/*.qbk'],
+            'matches': ['feed/history/*.qbk|released', 'feed/downloads/*.qbk'],
             'count': 3
         },
         'feed/history.rss' : {
             'title': 'Boost History',
-            'matches': ['feed/history/*.qbk']
+            'matches': ['feed/history/*.qbk|released']
         },
         'feed/news.rss' : {
             'title': 'Boost News',
-            'matches': ['feed/news/*.qbk', 'feed/history/*.qbk'],
+            'matches': ['feed/news/*.qbk', 'feed/history/*.qbk|released'],
+            'count': 5
+        },
+        'feed/dev.rss' : {
+            'title': 'Boost Development',
+            'matches': ['feed/history/*.qbk'],
             'count': 5
         }
     }
Modified: website/public_html/beta/site-tools/templates/history-template.html
==============================================================================
--- website/public_html/beta/site-tools/templates/history-template.html	(original)
+++ website/public_html/beta/site-tools/templates/history-template.html	2011-07-17 15:31:01 EDT (Sun, 17 Jul 2011)
@@ -1,6 +1,6 @@
 ${
 title = 'Boost Version History'
-entries = pages.match_pages(['feed/history/*.qbk'])
+entries = pages.match_pages(['feed/history/*.qbk|released'])
 }$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
Modified: website/public_html/beta/site-tools/templates/index-src.html
==============================================================================
--- website/public_html/beta/site-tools/templates/index-src.html	(original)
+++ website/public_html/beta/site-tools/templates/index-src.html	2011-07-17 15:31:01 EDT (Sun, 17 Jul 2011)
@@ -1,6 +1,6 @@
 ${
 # TODO: This is duplicated from other places, should only be set once?
-news = pages.match_pages(['feed/news/*.qbk', 'feed/history/*.qbk'], 3)
+news = pages.match_pages(['feed/news/*.qbk', 'feed/history/*.qbk|released'], 3)
 }$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
Modified: website/public_html/beta/site-tools/templates/news-template.html
==============================================================================
--- website/public_html/beta/site-tools/templates/news-template.html	(original)
+++ website/public_html/beta/site-tools/templates/news-template.html	2011-07-17 15:31:01 EDT (Sun, 17 Jul 2011)
@@ -1,6 +1,6 @@
 ${
 title = 'Boost News'
-entries = pages.match_pages(['feed/news/*.qbk', 'feed/history/*.qbk'], 5)
+entries = pages.match_pages(['feed/news/*.qbk', 'feed/history/*.qbk|released'], 5)
 }$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">