Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75500 - website/public_html/beta/site-tools/boost_site
From: dnljms_at_[hidden]
Date: 2011-11-15 17:40:34


Author: danieljames
Date: 2011-11-15 17:40:33 EST (Tue, 15 Nov 2011)
New Revision: 75500
URL: http://svn.boost.org/trac/boost/changeset/75500

Log:
Quickbook: Store release status in its own field.

Will just generate flags on load.
Text files modified:
   website/public_html/beta/site-tools/boost_site/pages.py | 40 ++++++++++++++++++++--------------------
   website/public_html/beta/site-tools/boost_site/upgrade.py | 26 +++++++++++++++++++++++++-
   2 files changed, 45 insertions(+), 21 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-11-15 17:40:33 EST (Tue, 15 Nov 2011)
@@ -150,11 +150,7 @@
 
         self.type = attrs.get('type', None)
         self.page_state = attrs.get('page_state', None)
- self.flags = attrs.get('flags', '')
- if self.flags:
- self.flags = set(self.flags.split(','))
- else:
- self.flags = set()
+ self.release_status = attrs.get('release_status', None)
         self.dir_location = attrs.get('dir_location', None)
         self.location = attrs.get('location', None)
         self.id = attrs.get('id', None)
@@ -169,11 +165,26 @@
 
         self.loaded = False
 
+ self.initialise()
+
+ def initialise(self):
+ self.flags = set()
+
+ if self.type == 'release':
+ if not self.release_status and self.pub_date != 'In Progress':
+ self.release_status = 'released'
+ if self.release_status and self.release_status not in ['released', 'beta']:
+ print "Error: Unknown release status: " + self.release_status
+ self.release_status = None
+ if self.release_status:
+ self.flags.add(self.release_status)
+
+
     def state(self):
         return {
             'type': self.type,
             'page_state': self.page_state,
- 'flags': ','.join(self.flags),
+ 'release_status': self.release_status,
             'dir_location': self.dir_location,
             'location': self.location,
             'id' : self.id,
@@ -204,23 +215,12 @@
             self.location = self.dir_location + self.id + '.html'
             self.dir_location = None
             self.page_state = None
-
- self.flags = set()
-
- if self.type == 'release':
- status = values['status_item']
- if status == 'release':
- status = 'released'
- if not status and self.pub_date != 'In Progress':
- status = 'released'
- if status and status not in ['released', 'beta']:
- print "Error: Unknown status: " + status
- status = None
- if status:
- self.flags.add(status)
+ self.release_status = values['status_item']
 
         self.loaded = True
 
+ self.initialise()
+
     def web_date(self):
         if self.pub_date == 'In Progress':
             return self.pub_date

Modified: website/public_html/beta/site-tools/boost_site/upgrade.py
==============================================================================
--- website/public_html/beta/site-tools/boost_site/upgrade.py (original)
+++ website/public_html/beta/site-tools/boost_site/upgrade.py 2011-11-15 17:40:33 EST (Tue, 15 Nov 2011)
@@ -29,9 +29,33 @@
             page.type = 'page'
     pages.save()
 
+def upgrade3():
+ pages_raw = boost_site.state.load('site-tools/state/feed-pages.txt')
+ for page in pages_raw:
+ page_details = pages_raw[page]
+ flags = page_details['flags']
+ flags = set(page_details['flags'].split(','))
+ if '' in flags:
+ flags.remove('')
+ type = page_details['type']
+ if type == 'release':
+ if 'released' in flags:
+ page_details['release_status'] = 'released'
+ flags.remove('released')
+ elif 'beta' in flags:
+ page_details['release_status'] = 'beta'
+ flags.remove('beta')
+ else:
+ page_details['release_status'] = None
+ if len(flags) != 0:
+ raise Exception("Unexpected flags: " + str(flags))
+ del page_details['flags']
+ boost_site.state.save(pages_raw, 'site-tools/state/feed-pages.txt')
+
 versions = [
         upgrade1,
- upgrade2
+ upgrade2,
+ upgrade3
         ]
 
 #


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk