def runAction(self, actionContext): viewSelection = actionContext.getViewSelection() document = ZBlogDocument() pubMetaData = self._createPubMetaData(viewSelection) if pubMetaData: document.addPubMetaData(pubMetaData) editorWindow = getEditorWindow() editorWindow.openDocument(document) editorWindow.Show()
def deserialize(self, documentDom, deserializationContext): documentDom.setNamespaceMap(self.nssMap) document = ZBlogDocument() document.setId(documentDom.documentElement.getAttribute( u"entry-id")) #$NON-NLS-1$ self._deserializeAttributes(documentDom.documentElement, document) self._deserializeTrackbacks(documentDom, document) self._deserializeBlogInfoList(documentDom, document) self._deserializePubMetaDataList(documentDom, document) self._deserializeTagwordsList(documentDom, document) self._deserializeContent(documentDom, document, deserializationContext) return document
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
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
def _createRavenDocument(self, zblog, serverEntry): # Create and return IZDocument # main document struct. zdoc = ZBlogDocument() # FIXME (PJ) server api needs separate dt fields for creation-time vs published time vs updated-time. schemaDt = ZSchemaDateTime(serverEntry.getUtcDateTime()) zdoc.setCreationTime(schemaDt) zdoc.setLastModifiedTime(schemaDt) # FIXME (PJ) Test test for entries with out a title (else autogen titles) zdoc.setTitle(serverEntry.getTitle()) # tagwords, if any. self._createRavenTagwords(zdoc, serverEntry) # blog info (including pubinfo object) zbloginfo = self._createRavenBlogInfo(zblog, serverEntry) # add blog info to doc zdoc.addBlogInfo(zbloginfo) # server side content content = serverEntry.getContent() # convert to Raven IZDocumentContent xhtml model zdocContent = self._createRavenContent(content) # add content to doc zdoc.setContent(zdocContent) # TODO: zdoc.setTagwords() and zdoc.add/setTrackback return zdoc
def _createDocument(self, actionContext): blog = actionContext.getBlog() document = ZBlogDocument() document.addPubMetaData(createDefaultPubMetaDataForBlog(blog)) return document