changeset 50:cf77bd13aad9

add support for headers
author k0s <k0scist@gmail.com>
date Sat, 26 Dec 2009 21:41:00 -0500
parents 4efeb3ecab7a
children c7819dbf7733
files bitsyblog/bitsyblog.py bitsyblog/factory.py bitsyblog/templates/navigation.html
diffstat 3 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sat Dec 26 13:08:48 2009 -0500
+++ b/bitsyblog/bitsyblog.py	Sat Dec 26 21:41:00 2009 -0500
@@ -31,7 +31,6 @@
 from docutils.utils import SystemMessage
 from genshi.builder import Markup
 from genshi.template import TemplateLoader
-#from lxml import etree
 from pkg_resources import resource_filename
 from urlparse import urlparse
 from user import FilespaceUsers
@@ -53,6 +52,7 @@
                  'subject': '[ %(date)s ]:',
                  'n_links': 5, # number of links for navigation
                  'site_name': 'bitsyblog',
+                 'header': None,
                  'auto_reload': 'True',
                  'help_file': None,
                  }
@@ -78,8 +78,6 @@
         self.loader = TemplateLoader(resource_filename(__name__, 'templates'),
                                      auto_reload=self.auto_reload.lower()=='true')
 
-        # static file renderer
-
         # helpfile
         if self.help_file and os.path.exists(self.help_file):
             help = file(self.help_file).read()
@@ -87,6 +85,10 @@
                                                      writer_name='html',
                                                      settings_overrides={'report_level': 5})
 
+        # header
+        if self.header:
+            self.header = Markup(self.header)
+
         # for BitsyAuth
         self.newuser = self.users.new
 
@@ -100,6 +102,7 @@
                                     'request': request,
                                     'link': self.link,
                                     'logo': self.logo(request),
+                                    'header': self.header,
                                     'user_url': self.user_url,
                                     'permalink': self.permalink }
 
--- a/bitsyblog/factory.py	Sat Dec 26 13:08:48 2009 -0500
+++ b/bitsyblog/factory.py	Sat Dec 26 21:41:00 2009 -0500
@@ -17,7 +17,7 @@
 
 def bitsierfactory(global_conf, **app_conf):
     """make single-user bitsyblog"""
-    config = [ 'file_dir', 'date_format', 'subject', 'n_links', 'help_file' ]
+    config = [ 'file_dir', 'date_format', 'subject', 'n_links', 'help_file', 'header' ]
     key_str = 'bitsyblog.%s'
     args = dict([ (key, app_conf[ key_str % key]) for key in config
                   if app_conf.has_key(key_str % key) ])
--- a/bitsyblog/templates/navigation.html	Sat Dec 26 13:08:48 2009 -0500
+++ b/bitsyblog/templates/navigation.html	Sat Dec 26 21:41:00 2009 -0500
@@ -6,6 +6,8 @@
       xmlns:xi="http://www.w3.org/2001/XInclude"
       py:strip="True">
 
+  <py:if test="header">${header}</py:if>
+
   <!-- nav bar -->
   <div class="site-nav">
     <ul>