コード例 #1
0
ファイル: content.py プロジェクト: sassman/pyslet
 def RenderHTML(self, parent, profile, itemState):
     """Overrides :py:meth:`BodyElement.RenderHTML`, the result is always a
     Div with class set to "itemBody".  Unlike other such method *parent* may
     by None, in which case a new parentless Div is created."""
     if parent:
         htmlDiv = parent.ChildElement(html.Div)
     else:
         htmlDiv = html.Div(None)
     htmlDiv.styleClass = "itemBody"
     self.RenderHTMLChildren(htmlDiv, profile, itemState)
コード例 #2
0
ファイル: items.py プロジェクト: sassman/pyslet
    def RenderHTML(self, itemState, htmlParent=None):
        """Renders this item in html, adding nodes to *htmlParent*.  The state
        of the item (e.g., the values of any controls and template variables),
        is taken from *itemState*, a :py:class:`variables.ItemSessionState`
        instance.

        The result is the top-level div containing the item added to the
        htmlParent. If htmlParent is None then a parentless div is created. If
        the item has no itemBody then an empty Div is returned."""
        if self.ItemBody:
            htmlDiv = self.ItemBody.RenderHTML(htmlParent, content.HTMLProfile,
                                               itemState)
        else:
            if htmlParent:
                htmlDiv = htmlParent.ChildElement(html.Div)
            else:
                htmlDiv = html.Div(None)
        return htmlDiv