"""A baseclass for the SkeletonPage template""" ################################################## # DEPENDENCIES ## import os import time # intra-package imports ... from Cheetah.Template import Template ################################################## # CLASSES ## class _SkeletonPage(Template): """A baseclass for the SkeletonPage template""" docType = '' # docType = '' title = '' siteDomainName = 'www.example.com' siteCredits = 'Designed & Implemented by Tavis Rudd' siteCopyrightName = "Tavis Rudd" htmlTag = '' def __init__(self, *args, **KWs): Template.__init__(self, *args, **KWs) self._metaTags = { 'HTTP-EQUIV': { 'keywords': 'Cheetah', 'Content-Type': 'text/html; charset=iso-8859-1', }, 'NAME': { 'generator': 'Cheetah: The Python-Powered Template Engine' } } # metaTags = { # 'HTTP_EQUIV':{'test':1234}, # 'NAME':{'test':1234,'test2':1234} # } self._stylesheets = {} # stylesheets = {'.cssClassName':'stylesheetCode'} self._stylesheetsOrder = [] # stylesheetsOrder = ['.cssClassName',] self._stylesheetLibs = {} # stylesheetLibs = {'libName':'libSrcPath'} self._javascriptLibs = {} self._javascriptTags = {} # self._javascriptLibs = {'libName':'libSrcPath'} self._bodyTagAttribs = {} def metaTags(self): """ Return a formatted vesion of the self._metaTags dictionary, using the formatMetaTags function from Cheetah.Macros.HTML""" return self.formatMetaTags(self._metaTags) def stylesheetTags(self): """Return a formatted version of the self._stylesheetLibs and self._stylesheets dictionaries. The keys in self._stylesheets must be listed in the order that they should appear in the list self._stylesheetsOrder, to ensure that the style rules are defined in the correct order.""" stylesheetTagsTxt = '' for title, src in self._stylesheetLibs.items(): stylesheetTagsTxt += \ '\n' if not self._stylesheetsOrder: return stylesheetTagsTxt stylesheetTagsTxt += '\n' return stylesheetTagsTxt def javascriptTags(self): """Return a formatted version of the javascriptTags and javascriptLibs dictionaries Each value in javascriptTags should be a either a code string to include, or a list containing the JavaScript version number and the code string. The keys can be anything. The same applies for javascriptLibs, but the string should be the SRC filename rather than a code string. """ javascriptTagsTxt = [] for key, details in self._javascriptTags.items(): if not isinstance(details, (list, tuple)): details = ['', details] javascriptTagsTxt += ['\n'] for key, details in self._javascriptLibs.items(): if not isinstance(details, (list, tuple)): details = ['', details] javascriptTagsTxt += ['