From 98aee03ca0e23ee593d76be846b4548c91438c2e Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Mon, 19 Oct 2009 21:35:07 +0000 Subject: [PATCH] added ability to add tags within landing page HEAD tag --- direct/src/http/LandingPage.py | 17 +++++++++++++++-- direct/src/http/LandingPageHTML.py | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/direct/src/http/LandingPage.py b/direct/src/http/LandingPage.py index 9ec2a7f67a..2e793e5dd3 100755 --- a/direct/src/http/LandingPage.py +++ b/direct/src/http/LandingPage.py @@ -3,13 +3,18 @@ from direct.directnotify.DirectNotifyGlobal import directNotify from pandac.PandaModules import VirtualFileSystem from pandac.PandaModules import Filename from pandac.PandaModules import DSearchPath +from direct.showbase import ElementTree as ET import LandingPageHTML +from StringIO import StringIO class LandingPage: notify = directNotify.newCategory("LandingPage") def __init__(self): self.headerTemplate = LandingPageHTML.header self.footerTemplate = LandingPageHTML.footer + + # allow modifications to the page head tag + self._headET = ET.Element('head') self.menu = {} @@ -47,10 +52,18 @@ class LandingPage: return LandingPageHTML.getTabs(self.menu,activeTab) def getHeader(self, activeTab = "Main"): + headContent = '' + for child in self._headET.getchildren(): + fileStr = StringIO() + ET.ElementTree(child).write(fileStr) + headContent += fileStr.getvalue() s = self.headerTemplate % {'titlestring' : LandingPageHTML.title, - 'menustring' : self.getMenu(activeTab)} + 'menustring' : self.getMenu(activeTab), + 'headContent' : headContent,} return s - + + def getHead(self): + return self._headET def getFooter(self): return self.footerTemplate % {'contact' : LandingPageHTML.contactInfo} diff --git a/direct/src/http/LandingPageHTML.py b/direct/src/http/LandingPageHTML.py index 779fea2f75..9b8ca4f860 100755 --- a/direct/src/http/LandingPageHTML.py +++ b/direct/src/http/LandingPageHTML.py @@ -261,6 +261,7 @@ header = ''' %(titlestring)s +%(headContent)s