<%!
    from mako.ext.autohandler import autohandler
%>
<%inherit file="${autohandler(template, context)}"/>
<%page cached="True" cache_key="${self.filename}"/>

<%doc> 
 base.html - common to all documentation pages. intentionally separate 
 from autohandler, which can be swapped out for a different one
</%doc>

<%
    # bootstrap TOC structure from request args, or pickled file if not present.
    import cPickle as pickle
    import os, time
    #print "%s generating from table of contents for file %s" % (local.filename, self.filename)
    filename = os.path.join(os.path.dirname(self.filename), 'table_of_contents.pickle')
    toc = pickle.load(file(filename))
    version = toc.version
    last_updated = toc.last_updated

    kwargs = context.kwargs
    kwargs.setdefault('extension', 'html')
    extension = kwargs['extension']
    kwargs.setdefault('paged', True)
    kwargs.setdefault('toc', toc)
%>

<div id="topanchor"><a name="top">&nbsp;</a></div>


<h1>${toc.root.doctitle}</h1>

<div id="pagecontrol"><a href="index.${extension}">Multiple Pages</a> | <a href="documentation.${extension}">One Page</a></div>

<div class="versionheader">Version: ${version}   Last Updated: ${time.strftime('%x %X', time.localtime(last_updated))}</div>

${next.body(**kwargs)}



