def default(self,*args):
     if len(args) != 1:
         raise cherrypy.HTTPRedirect(turbogears.url("/panels"))
     panelname=args[0]
     print "panel renderer: "+panelname+"\n"
     try:
         panelDef = readPanelDefinition("../resources/paneldef/",panelname)
     except PanelDefinitionException, e:
         turbogears.flash(str(e))
         raise cherrypy.HTTPRedirect(turbogears.url("/panels"))
Example #2
0
def makePanelHtml(pdDir,pdName):
    """
    Read a panel definition file and return it as an HTML string, 
    using the Tubogears template processor.
    """
    pdDict = readPanelDefinition(pdDir,pdName)
    output = XMLSerializer(encoding="UTF-8", decl=True, 
                doctype=("html",
                         "-//W3C//DTD XHTML, 1.0 Strict//EN", 
                         "http://www.w3.org/TR/xhtml1-strict-dtd"))
    pdHtml = render(pdDict,template="WebBrickGateway.templates.paneldef",formatter=output)
    return pdHtml