def _createPubMetaData(self, blogInfo): pubMetaData = createDefaultPubMetaData(blogInfo.getAccountId(), blogInfo.getBlogId()) pubMetaData.setPublishAsDraft(blogInfo.getPublishInfo().isDraft()) pubMetaData.setPublishTime( blogInfo.getPublishInfo().getPublishedTime()) categories = blogInfo.getCategories() if categories is not None and len(categories) > 0: for category in categories: pubMetaData.addCategory(category) # WP custom attrs slug = getNoneString( getWPPublishedInfoAttribute(blogInfo.getPublishInfo(), u"wp_slug")) #$NON-NLS-1$ if slug: setCustomWPMetaDataAttribute(pubMetaData, u"wp_slug", slug) #$NON-NLS-1$ pw = getSafeString( getWPPublishedInfoAttribute(blogInfo.getPublishInfo(), u"wp_password")) #$NON-NLS-1$ setCustomWPMetaDataAttribute(pubMetaData, u"wp_password", pw) #$NON-NLS-1$ status = getNoneString( getWPPublishedInfoAttribute(blogInfo.getPublishInfo(), u"post_status")) #$NON-NLS-1$ if status: setCustomWPMetaDataAttribute(pubMetaData, u"post_status", status) #$NON-NLS-1$ return pubMetaData
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, blogInfo): pubMetaData = createDefaultPubMetaData(blogInfo.getAccountId(), blogInfo.getBlogId()) pubMetaData.setPublishAsDraft(blogInfo.getPublishInfo().isDraft()) pubMetaData.setPublishTime(blogInfo.getPublishInfo().getPublishedTime()) categories = blogInfo.getCategories() if categories is not None and len(categories) > 0: for category in categories: pubMetaData.addCategory(category) # WP custom attrs slug = getNoneString( getWPPublishedInfoAttribute(blogInfo.getPublishInfo(), u"wp_slug") ) #$NON-NLS-1$ if slug: setCustomWPMetaDataAttribute(pubMetaData, u"wp_slug", slug) #$NON-NLS-1$ pw = getSafeString( getWPPublishedInfoAttribute(blogInfo.getPublishInfo(), u"wp_password") ) #$NON-NLS-1$ setCustomWPMetaDataAttribute(pubMetaData, u"wp_password", pw) #$NON-NLS-1$ status = getNoneString( getWPPublishedInfoAttribute(blogInfo.getPublishInfo(), u"post_status") ) #$NON-NLS-1$ if status: setCustomWPMetaDataAttribute(pubMetaData, u"post_status", status) #$NON-NLS-1$ return pubMetaData
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