コード例 #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
ファイル: file_new.py プロジェクト: Tidosho/zoundryraven
    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
コード例 #5
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
コード例 #6
0
ファイル: blogactions.py プロジェクト: Tidosho/zoundryraven
 def _createDocument(self, actionContext):
     blog = actionContext.getBlog()
     document = ZBlogDocument()
     document.addPubMetaData(createDefaultPubMetaDataForBlog(blog))
     return document
コード例 #7
0
ファイル: blogconfig.py プロジェクト: mpm2050/Raven
 def _createPubMetaDataFromBlog(self):
     return createDefaultPubMetaDataForBlog(self.blog)
コード例 #8
0
ファイル: blogactions.py プロジェクト: mpm2050/Raven
 def _createDocument(self, actionContext):
     blog = actionContext.getBlog()
     document = ZBlogDocument()
     document.addPubMetaData(createDefaultPubMetaDataForBlog(blog))
     return document