This method sets up a TCCPage instance to
hold the month's content. Links to the documentation for
tccpage2.py are in Section 3, “Overview of the internals”.
# - - - M o n t h C e l l . _ _ p a g e F r a m e
def __pageFrame ( self, prev, next ):
'''Set up an empty tccpage2.TCCPage instance.
[ (prev is the 'yyyy-mm' of the previous month or None) and
[ (next is the 'yyyy-mm' of the next month or None) ->
return a new TCCPage instance with navigation links
previous=(prev's page) and next=(next's page) ]
'''
For the navigational link plan, see Section 4, “The generated XHTML”. We have four navigational features: links to nextURL;
links to prevURL; goes
to the index page; and goes
to Shipman's home page.
To transform the target month numbers into relative URLs,
we can't assume that the referenced pages are in
the same directory. For instance, the predecessor
of '1998-01.xml' might be URL
'../1997/1997-12.xml'. For simplicity,
we'll always go up one level and then back down.
#-- 1 --
# [ if prev is None ->
# prevList := an empty list
# else ->
# prevList := [(name of month prev,URL of prev)] ]
#--
# 0123456
# yyyy-mm <-- Value of 'prev' or 'next'
#--
if prev is None:
prevList = []
else:
prevYYYY = prev[:4]
prevMM = prev[5:]
prevURL = ( '../%s/%s%s' %
(prevYYYY, prev, HTML_EXT) )
prevText = MonthCell.monthName(prev)
prevList = [(prevText, prevURL)]
#-- 2 --
# [ if next is None ->
# nextList := an empty list
# else ->
# nextList := [(name of month next,URL of next)] ]
if next is None:
nextList = []
else:
nextYYYY = next[:4]
nextMM = next[5:]
nextURL = ( '../%s/%s%s' %
(nextYYYY, next, HTML_EXT) )
nextText = MonthCell.monthName(next)
nextList = [(nextText, nextURL)]
Next, build the list of NavLink instances
describing the page's navigational features.
#-- 2 --
# [ navList := a list of tccpage2.NavLink instances
# representing the navigational features ]
navList = (
tccpage2.NavLink ( 'Next', nextList ),
tccpage2.NavLink ( 'Previous', prevList ),
tccpage2.NavLink ( 'Contents',
[("Shipman's Field Notes",
'../%s%s' % (INDEX_PAGE_NAME, HTML_EXT))] ),
tccpage2.NavLink ( 'Home',
[("Shipman's Home Sweet Homepage", HOME_PAGE_URL)] ) )
All that remains is to build and return the TCCPage instance.
#-- 3 --
return tccpage2.TCCPage ( self.title, navList,
logoImage=ZDP_LOGO, logoLink=ZDP_URL, cssUrl=CSS_URL )