Example #1
0
    def _deserializeContent(self, documentDom, document, deserializationContext):
        contentNode = documentDom.selectSingleNode(u"/zns:entry/zns:content") #$NON-NLS-1$

        # Handle the Case of the Missing Content
        if not contentNode:
            xhtmlDoc = loadXhtmlDocumentFromString(u"") #$NON-NLS-1$
            content = ZXhtmlContent()
            content.setMode(u"xml") #$NON-NLS-1$
            content.setType(u"application/xhtml+xml") #$NON-NLS-1$
            content.setXhtmlDocument(xhtmlDoc)
            document.setContent(content)
            return

        self._processContent(contentNode, deserializationContext)

        mode = contentNode.getAttribute(u"mode") #$NON-NLS-1$
        type = contentNode.getAttribute(u"type") #$NON-NLS-1$

        content = ZXhtmlContent()
        content.setMode(mode)
        content.setType(type)

        if mode == u"xml": #$NON-NLS-1$
            xhtmlNode = contentNode.selectSingleNode(u"*") #$NON-NLS-1$
            xhtmlDoc = loadXhtmlDocumentFromDOM(xhtmlNode)
            content.setXhtmlDocument(xhtmlDoc)
        elif mode == u"escaped": #$NON-NLS-1$
            htmlText = contentNode.getText()
            xhtmlDoc = loadXhtmlDocumentFromString(htmlText)
            content.setXhtmlDocument(xhtmlDoc)
        else:
            raise ZBlogAppException(_extstr(u"deserializers.NoContentModeFoundError")) #$NON-NLS-1$

        document.setContent(content)
Example #2
0
 def _createRavenContent(self, serverContent):
     # Created and return xhtml content in IZDocumentContent.
     # content holder.
     zdocContent = ZXhtmlContent()
     zdocContent.setType(u"application/xhtml+xml") #$NON-NLS-1$
     zdocContent.setMode(u"xml") #$NON-NLS-1$
     xhtmlDoc = loadXhtmlDocumentFromString(serverContent)
     zdocContent.setXhtmlDocument(xhtmlDoc)
     return zdocContent
 def _createRavenContent(self, serverContent):
     # Created and return xhtml content in IZDocumentContent.
     # content holder.
     zdocContent = ZXhtmlContent()
     zdocContent.setType(u"application/xhtml+xml")  #$NON-NLS-1$
     zdocContent.setMode(u"xml")  #$NON-NLS-1$
     xhtmlDoc = loadXhtmlDocumentFromString(serverContent)
     zdocContent.setXhtmlDocument(xhtmlDoc)
     return zdocContent
 def __init__(self):
     ZBlogDocument.__init__(self)
     
     self.setId(u"_template_preview_document_") #$NON-NLS-1$
     self.setTitle(u"Proin tincidunt. Sed sapien libero, feugiat eu, tristique.") #$NON-NLS-1$
     self.setCreationTime(ZSchemaDateTime())
     self.setLastModifiedTime(ZSchemaDateTime())
     
     content = ZXhtmlContent()
     content.setMode(u"xml") #$NON-NLS-1$
     content.setType(u"application/xhtml+xml") #$NON-NLS-1$
     content.setXhtmlDocument(self._createXHtmlDocument())
     self.setContent(content)
Example #5
0
    def _createDocument(self):
        document = ZBlogDocument()
        document.setTitle(u"RAVEN_TEMPLATE_FETCH_TITLE") #$NON-NLS-1$
        document.setCreationTime(ZSchemaDateTime())
        document.setLastModifiedTime(ZSchemaDateTime())

        xhtmlDoc = loadXhtmlDocumentFromString(u"<p id='_raven_template_body'>RAVEN_TEMPLATE_FETCH_BODY</p>") #$NON-NLS-1$
        content = ZXhtmlContent()
        content.setMode(u"xml") #$NON-NLS-1$
        content.setType(u"application/xhtml+xml") #$NON-NLS-1$
        content.setXhtmlDocument(xhtmlDoc)
        document.setContent(content)

        return document
Example #6
0
 def createBlogDocument(self):
     u"""createBlogDocument( -> IZBlogDocument"""  #$NON-NLS-1$
     xhtmlDoc = self.createXhtmlDocument()
     doc = ZBlogDocument()
     title = getNoneString(self.izBlogThisInformation.getTitle())
     if not title:
         title = getSafeString(xhtmlDoc.getTitle())
     doc.setTitle(title)
     content = ZXhtmlContent()
     content.setMode(u"xml")  #$NON-NLS-1$
     content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
     content.setXhtmlDocument(xhtmlDoc)
     doc.setContent(content)
     return doc
Example #7
0
 def createBlogDocument(self):
     u"""createBlogDocument( -> IZBlogDocument""" #$NON-NLS-1$
     xhtmlDoc = self.createXhtmlDocument()
     doc = ZBlogDocument()
     title = getNoneString( self.izBlogThisInformation.getTitle() )
     if not title:
         title = getSafeString( xhtmlDoc.getTitle() )
     doc.setTitle( title )
     content = ZXhtmlContent()
     content.setMode(u"xml") #$NON-NLS-1$
     content.setType(u"application/xhtml+xml") #$NON-NLS-1$
     content.setXhtmlDocument(xhtmlDoc)
     doc.setContent(content)
     return doc
Example #8
0
    def __init__(self):
        ZBlogDocument.__init__(self)

        self.setId(u"_template_preview_document_")  #$NON-NLS-1$
        self.setTitle(
            u"Proin tincidunt. Sed sapien libero, feugiat eu, tristique."
        )  #$NON-NLS-1$
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(self._createXHtmlDocument())
        self.setContent(content)
    def __init__(self, title, xhtmlDoc):
        self.title = title
        self.xhtmlDoc = xhtmlDoc

        ZBlogDocument.__init__(self)

        self.setId(u"_blog_post_editor_preview_document_") #$NON-NLS-1$
        self.setTitle(self.title)
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml") #$NON-NLS-1$
        content.setType(u"application/xhtml+xml") #$NON-NLS-1$
        content.setXhtmlDocument(self.xhtmlDoc)
        self.setContent(content)
Example #10
0
    def __init__(self, title, xhtmlDoc):
        self.title = title
        self.xhtmlDoc = xhtmlDoc

        ZBlogDocument.__init__(self)

        self.setId(u"_blog_post_editor_preview_document_")  #$NON-NLS-1$
        self.setTitle(self.title)
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(self.xhtmlDoc)
        self.setContent(content)
Example #11
0
    def _createDocument(self):
        document = ZBlogDocument()
        document.setTitle(u"RAVEN_TEMPLATE_FETCH_TITLE")  #$NON-NLS-1$
        document.setCreationTime(ZSchemaDateTime())
        document.setLastModifiedTime(ZSchemaDateTime())

        xhtmlDoc = loadXhtmlDocumentFromString(
            u"<p id='_raven_template_body'>RAVEN_TEMPLATE_FETCH_BODY</p>"
        )  #$NON-NLS-1$
        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(xhtmlDoc)
        document.setContent(content)

        return document
Example #12
0
    def _deserializeContent(self, documentDom, document,
                            deserializationContext):
        contentNode = documentDom.selectSingleNode(
            u"/zns:entry/zns:content")  #$NON-NLS-1$

        # Handle the Case of the Missing Content
        if not contentNode:
            xhtmlDoc = loadXhtmlDocumentFromString(u"")  #$NON-NLS-1$
            content = ZXhtmlContent()
            content.setMode(u"xml")  #$NON-NLS-1$
            content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
            content.setXhtmlDocument(xhtmlDoc)
            document.setContent(content)
            return

        self._processContent(contentNode, deserializationContext)

        mode = contentNode.getAttribute(u"mode")  #$NON-NLS-1$
        type = contentNode.getAttribute(u"type")  #$NON-NLS-1$

        content = ZXhtmlContent()
        content.setMode(mode)
        content.setType(type)

        if mode == u"xml":  #$NON-NLS-1$
            xhtmlNode = contentNode.selectSingleNode(u"*")  #$NON-NLS-1$
            xhtmlDoc = loadXhtmlDocumentFromDOM(xhtmlNode)
            content.setXhtmlDocument(xhtmlDoc)
        elif mode == u"escaped":  #$NON-NLS-1$
            htmlText = contentNode.getText()
            xhtmlDoc = loadXhtmlDocumentFromString(htmlText)
            content.setXhtmlDocument(xhtmlDoc)
        else:
            raise ZBlogAppException(
                _extstr(
                    u"deserializers.NoContentModeFoundError"))  #$NON-NLS-1$

        document.setContent(content)