示例#1
0
 def __init__(self, zblog, zblogDocument, zpubMetaData, notifyCallback):
     self.notifyCallback = notifyCallback
     self.preprocessHandlers = None
     self.postprocessHandlers = None
     self.totalWorkUnits = 0
     self.prepared = False
     self.preprocessed = False
     self.postprocessed =False
     self.zblog = zblog
     self.zblogDocument = zblogDocument
     # get copy of xhtml document.
     self.xhtmlDocument = self.zblogDocument.getContent().getXhtmlDocument().clone()
     # FIXME (PJ) create immutable copy of meta data.
     self.zpubMetaData = zpubMetaData
     # if meta data is not given, the look in blogdocument for pubmeta data.
     if self.zpubMetaData is None:
         for metadata in zblogDocument.getPubMetaDataList():
             if metadata.getBlogId() == zblog.getId():
                 self.zpubMetaData = metadata
                 break
     # default case.
     if self.zpubMetaData is None:
         self.zpubMetaData = createDefaultPubMetaDataForBlog(zblog)
     self.context = ZPublishingHandlerContext(zblogDocument, self.xhtmlDocument, self.zpubMetaData, self)
     self._createPreprocessHandlers()
     self._createPostprocessHandlers()
示例#2
0
 def __init__(self, zblog, zblogDocument, zpubMetaData, notifyCallback):
     self.notifyCallback = notifyCallback
     self.preprocessHandlers = None
     self.postprocessHandlers = None
     self.totalWorkUnits = 0
     self.prepared = False
     self.preprocessed = False
     self.postprocessed = False
     self.zblog = zblog
     self.zblogDocument = zblogDocument
     # get copy of xhtml document.
     self.xhtmlDocument = self.zblogDocument.getContent().getXhtmlDocument(
     ).clone()
     # FIXME (PJ) create immutable copy of meta data.
     self.zpubMetaData = zpubMetaData
     # if meta data is not given, the look in blogdocument for pubmeta data.
     if self.zpubMetaData is None:
         for metadata in zblogDocument.getPubMetaDataList():
             if metadata.getBlogId() == zblog.getId():
                 self.zpubMetaData = metadata
                 break
     # default case.
     if self.zpubMetaData is None:
         self.zpubMetaData = createDefaultPubMetaDataForBlog(zblog)
     self.context = ZPublishingHandlerContext(zblogDocument,
                                              self.xhtmlDocument,
                                              self.zpubMetaData, self)
     self._createPreprocessHandlers()
     self._createPostprocessHandlers()
示例#3
0
    def _createDocument(self, actionContext): #@UnusedVariable
        document = ZBlogDocument()

        accountStore = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        accounts = accountStore.getAccounts()
        if accounts and len(accounts) == 1:
            account = accounts[0]
            blogs = account.getBlogs()
            if blogs and len(blogs) == 1:
                blog = blogs[0]
                document.addPubMetaData(createDefaultPubMetaDataForBlog(blog))

        return document
示例#4
0
    def _createPubMetaData(self, selection):
        if selection is not None and selection.getType() in ZWriteToolBarAction.VALID_TYPES:
            (accountId, blogId) = selection.getData()
            if blogId is not None:
                return createDefaultPubMetaData(accountId, blogId)

        accountStore = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        accounts = accountStore.getAccounts()
        if accounts and len(accounts) == 1:
            account = accounts[0]
            blogs = account.getBlogs()
            if blogs and len(blogs) == 1:
                blog = blogs[0]
                return createDefaultPubMetaDataForBlog(blog)

        return None
    def _createPubMetaData(self, selection):
        if selection is not None and selection.getType(
        ) in ZWriteToolBarAction.VALID_TYPES:
            (accountId, blogId) = selection.getData()
            if blogId is not None:
                return createDefaultPubMetaData(accountId, blogId)

        accountStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        accounts = accountStore.getAccounts()
        if accounts and len(accounts) == 1:
            account = accounts[0]
            blogs = account.getBlogs()
            if blogs and len(blogs) == 1:
                blog = blogs[0]
                return createDefaultPubMetaDataForBlog(blog)

        return None
示例#6
0
 def _createDocument(self, actionContext):
     blog = actionContext.getBlog()
     document = ZBlogDocument()
     document.addPubMetaData(createDefaultPubMetaDataForBlog(blog))
     return document
示例#7
0
 def _createPubMetaDataFromBlog(self):
     return createDefaultPubMetaDataForBlog(self.blog)
示例#8
0
 def _createDocument(self, actionContext):
     blog = actionContext.getBlog()
     document = ZBlogDocument()
     document.addPubMetaData(createDefaultPubMetaDataForBlog(blog))
     return document