Пример #1
0
def createDefaultPubMetaDataForBlog(blog):
    if blog:
        pubMetaData = ZPubMetaData()
        pubMetaData.setAccountId(blog.getAccount().getId())
        pubMetaData.setBlogId(blog.getId())

        blogPrefs = blog.getPreferences()
        pubMetaData.setAddPoweredBy(
            blogPrefs.getUserPreferenceBool(
                IZBlogAppUserPrefsKeys.SP_ADD_POWERED_BY, False))
        pubMetaData.setForceReUploadImages(
            blogPrefs.getUserPreferenceBool(
                IZBlogAppUserPrefsKeys.SP_FORCE_REUPLOAD, False))
        pubMetaData.setUploadTNsOnly(
            blogPrefs.getUserPreferenceBool(
                IZBlogAppUserPrefsKeys.SP_UPLOAD_TNS_ONLY, False))
        pubMetaData.setAddLightbox(
            blogPrefs.getUserPreferenceBool(
                IZBlogAppUserPrefsKeys.SP_ADD_LIGHTBOX, False))
        pingSitesStr = blogPrefs.getUserPreference(
            IZBlogAppUserPrefsKeys.SP_PING_SITES, None)
        pingSites = deserializePingSiteList(pingSitesStr)
        pubMetaData.setPingServices(pingSites)
        tagSitesStr = blogPrefs.getUserPreference(
            IZBlogAppUserPrefsKeys.SP_TAG_SITES, None)
        tagSites = deserializeTagSiteList(tagSitesStr)
        pubMetaData.setTagspaceUrls(tagSites)
        return pubMetaData
    else:
        return None
Пример #2
0
    def _getPubMetaData(self, zblog, zblogDocument):
        pubMetaData = None
        for metadata in zblogDocument.getPubMetaDataList():
            if metadata.getBlogId() == zblog.getId():
                pubMetaData = metadata
                break
        if not pubMetaData:
            if self._getLogger():
                self._getLogger().warning(u"ZPubMetaData not found for blog %s and document %s" %(zblog.getId(), zblogDocument.getId())) #$NON-NLS-1$
            pubMetaData = ZPubMetaData()
            pubMetaData.setAccountId( self.getAccountId())
            pubMetaData.setBlogId(zblog.getId())
            pubMetaData.setAddPoweredBy(False)
            pubMetaData.setPublishAsDraft(False)
            pubMetaData.setForceReUploadImages(False)
            pubMetaData.setUploadTNsOnly(False)
            pubMetaData.setPublishTime(None)

        return pubMetaData
Пример #3
0
def createDefaultPubMetaDataForBlog(blog):
    if blog:
        pubMetaData = ZPubMetaData()
        pubMetaData.setAccountId(blog.getAccount().getId())
        pubMetaData.setBlogId(blog.getId())

        blogPrefs = blog.getPreferences()
        pubMetaData.setAddPoweredBy(blogPrefs.getUserPreferenceBool(IZBlogAppUserPrefsKeys.SP_ADD_POWERED_BY, False))
        pubMetaData.setForceReUploadImages(blogPrefs.getUserPreferenceBool(IZBlogAppUserPrefsKeys.SP_FORCE_REUPLOAD, False))
        pubMetaData.setUploadTNsOnly(blogPrefs.getUserPreferenceBool(IZBlogAppUserPrefsKeys.SP_UPLOAD_TNS_ONLY, False))
        pubMetaData.setAddLightbox(blogPrefs.getUserPreferenceBool(IZBlogAppUserPrefsKeys.SP_ADD_LIGHTBOX, False))
        pingSitesStr = blogPrefs.getUserPreference(IZBlogAppUserPrefsKeys.SP_PING_SITES, None)
        pingSites = deserializePingSiteList(pingSitesStr)
        pubMetaData.setPingServices(pingSites)
        tagSitesStr = blogPrefs.getUserPreference(IZBlogAppUserPrefsKeys.SP_TAG_SITES, None)
        tagSites = deserializeTagSiteList(tagSitesStr)
        pubMetaData.setTagspaceUrls(tagSites)
        return pubMetaData
    else:
        return None
    def _getPubMetaData(self, zblog, zblogDocument):
        pubMetaData = None
        for metadata in zblogDocument.getPubMetaDataList():
            if metadata.getBlogId() == zblog.getId():
                pubMetaData = metadata
                break
        if not pubMetaData:
            if self._getLogger():
                self._getLogger().warning(
                    u"ZPubMetaData not found for blog %s and document %s" %
                    (zblog.getId(), zblogDocument.getId()))  #$NON-NLS-1$
            pubMetaData = ZPubMetaData()
            pubMetaData.setAccountId(self.getAccountId())
            pubMetaData.setBlogId(zblog.getId())
            pubMetaData.setAddPoweredBy(False)
            pubMetaData.setPublishAsDraft(False)
            pubMetaData.setForceReUploadImages(False)
            pubMetaData.setUploadTNsOnly(False)
            pubMetaData.setPublishTime(None)

        return pubMetaData