Example #1
0
    def __init__(self, *content, **attrs):
        if attrs and 0:
            print "\nMyDocument attrs parameters:"
            for key in attrs.keys():
                print "\t%s: %s" % (key, attrs[key])
            print ""

        if attrs.has_key("title"):
            self.mytitle = attrs["title"]
            del attrs["title"]

        if attrs.has_key("stylesheet"):
            ## self.style is added to head automatically by Document
            # self.style = LINK (rel="stylesheet", type="text/css", href=attrs["stylesheet"])
            self.stylesheet = attrs['stylesheet']
            del attrs["stylesheet"]

        if attrs.has_key("javascript"):
            # self.javascript must added manually after call to Document.__init__
            self.javascript = attrs["javascript"]
            del attrs["javascript"]

        Document.__init__(self, *content, **attrs)
        ## if hasattr (self, "javascript"):self.head.append(self.javascript)
        if hasattr(self, "javascript"): self.addJavascript(self.javascript)
        if hasattr(self, "stylesheet"): self.addStylesheet(self.stylesheet)

        if hasattr(self, "mytitle"):
            self.head.append(TITLE(self.mytitle))
def Page(title):
    doc = Document(title=title)
    doc.append(html.H1(title))
    p = html.P("Menu:")
    p.append(html.BR())
    p.append(html.A("home",href="/"))
    p.append(html.BR())
    p.append(html.A("foo",href="foo/bar/baz"))
    p.append(html.BR())
    p.append(html.A("reports",href="report"))
    doc.append(p)
    doc.append(html.HR())
    return doc
Example #3
0
 def __init__(self,title,*args,**kw):
     self.title=html.TITLE(title)
     Document.__init__(self,*args,**kw)
Example #4
0
    def default(self,*args,**kw):
        title=str(self.dbsess)
        doc=Document(title=html.TITLE(title))
        
        div = html.DIV(klass="title")
        doc.append(div)
        div.append(html.H1(title))

        
        div = html.DIV(klass="menu")
        doc.append(div)
        
        p = html.P("Menu:")
        div.append(p)
        p.append(html.BR())
        p.append(html.A("home",href="/"))
        p.append(html.BR())
        p.append(html.A("foo",href="foo/bar/baz"))
        p.append(html.BR())
        p.append(html.A("reports",href="report"))
        

        doc.append(html.P(self.dbsess.app.aboutString()))
        doc.append(html.P('args='+repr(args)))
        doc.append(html.P('kw='+repr(kw)))
        #
        div = html.DIV(klass="footer")
        doc.append(div)
        div.append(html.P("foo "+cherrypy.request.base + " bar"))
        return str(doc)
Example #5
0
#!/usr/bin/python
from HyperText.HTML import BR, TABLE, TR, TH, TD, EM, quote_body
from HyperText.Documents import Document

t = TABLE()
tr = TR(TH(BR()))
for i in range(16):
    tr.append(TH(hex(i)))
t.append(tr)

for j in range(0, 128, 16):
    tr = TR(TH(hex(j)))
    t.append(tr)
    for i in range(16):
        v = i + j
        tr.append(TD(EM(v), BR(), quote_body(repr(chr(v)))))

d = Document(t)
print d
Example #6
0
 def __init__(self, title, *args, **kw):
     self.title = html.TITLE(title)
     Document.__init__(self, *args, **kw)