def _deserializeBlog(self, blogNode, account): blog = ZBlogFromAccount() blog.setId(blogNode.getAttribute(u"blog-id")) #$NON-NLS-1$ self._deserializeAttributes(blogNode, blog) self._deserializeBlogCategories(blogNode, blog) account.addBlog(blog)
def _createRavenBlog(self, zserverBlogInfo): # qid is a unique id with in the raven repository qid = self._createBlogQId( zserverBlogInfo.getId() ) zserverBlogInfo.setSystemId(qid) izblog = ZBlogFromAccount() izblog.setId( qid ) izblog.setAccount( self.getAccount() ) izblog.setName( zserverBlogInfo.getName() ) izblog.setUrl( zserverBlogInfo.getUrl() ) # copy over server side attribute to raven izblog model self._copyAttrsFromServerToRaven(zserverBlogInfo, izblog) return izblog
def _createRavenBlog(self, zserverBlogInfo): # qid is a unique id with in the raven repository qid = self._createBlogQId(zserverBlogInfo.getId()) zserverBlogInfo.setSystemId(qid) izblog = ZBlogFromAccount() izblog.setId(qid) izblog.setAccount(self.getAccount()) izblog.setName(zserverBlogInfo.getName()) izblog.setUrl(zserverBlogInfo.getUrl()) # copy over server side attribute to raven izblog model self._copyAttrsFromServerToRaven(zserverBlogInfo, izblog) return izblog
def _createAccountFromWLWBlogInfo(self, wlwBlogInfo): accountId = generate() accountDir = os.path.join(self.accountDir, accountId) account = ZWindowsLiveWriterAccount(accountDir) account.setId(accountId) account.setUsername(wlwBlogInfo.username) (siteName, siteId) = LIVE_WRITER_PROVIDER_MAP[wlwBlogInfo.providerId] #@UnusedVariable # Over rides fop WP 2.2 if wlwBlogInfo.clientType == u"WordPress" and wlwBlogInfo.serviceName == u"WordPress": #$NON-NLS-1$ #$NON-NLS-2$ siteId = u"zoundry.blogapp.pubsystems.publishers.site.wordpress22" #$NON-NLS-1$ apiInfo = ZAccountAPIInfo() apiInfo.setType(siteId) apiInfo.setUrl(wlwBlogInfo.postApiUrl) account.setAPIInfo(apiInfo) account.setName(wlwBlogInfo.blogName + u" Account") #$NON-NLS-1$ blog = ZBlogFromAccount() blog.setAccount(account) blogId = u"{urn:zoundry:acc:%s}%s" % (account.getId(), wlwBlogInfo.blogId) #$NON-NLS-1$ blog.setId(blogId) blog.setName(wlwBlogInfo.blogName) blog.setUrl(wlwBlogInfo.homepageUrl) # set WLW import attributes blog.setAttribute(u"clientType", unicode(wlwBlogInfo.clientType), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"serviceName", unicode(wlwBlogInfo.serviceName), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"providerId", unicode(wlwBlogInfo.providerId), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"fileUploadSupport", unicode(wlwBlogInfo.fileUploadSupport), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ if wlwBlogInfo.fileUploadSupport == 2: blog.setAttribute(u"ftpServer", unicode(wlwBlogInfo.ftpServer), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"ftpPath", unicode(wlwBlogInfo.ftpPath), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"ftpUrl", unicode(wlwBlogInfo.ftpUrl), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"ftpUsername", unicode(wlwBlogInfo.ftpUsername), IZBlogAppNamespaces.WLW_ACCOUNT_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"id", wlwBlogInfo.blogId, IZBlogAppNamespaces.CMS_PUBLISHER_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"name", unicode(wlwBlogInfo.blogName), IZBlogAppNamespaces.CMS_PUBLISHER_NAMESPACE) #$NON-NLS-1$ if siteId == DefaultSites.BLOGGER: # WLW may have the blogger legacy URL. Use the new url for api apiInfo.setUrl(u"http://www.blogger.com/feeds/default/blogs") #$NON-NLS-1$ linkBase = wlwBlogInfo.homepageUrl if not linkBase.endswith(u"/"): #$NON-NLS-1$ linkBase = linkBase + u"/" #$NON-NLS-1$ feedLink = linkBase + u"feeds/posts/default" #$NON-NLS-1$ altLink = wlwBlogInfo.homepageUrl postLink = wlwBlogInfo.postApiUrl catsLink = feedLink feedTitle = wlwBlogInfo.blogName atomId = wlwBlogInfo.blogId blog.setAttribute(u"feed-link", feedLink, IZBlogAppNamespaces.ATOM_PUBLISHER_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"alt-link", altLink, IZBlogAppNamespaces.ATOM_PUBLISHER_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"post-link", postLink, IZBlogAppNamespaces.ATOM_PUBLISHER_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"categories-link", catsLink, IZBlogAppNamespaces.ATOM_PUBLISHER_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"feed-title", feedTitle, IZBlogAppNamespaces.ATOM_PUBLISHER_NAMESPACE) #$NON-NLS-1$ blog.setAttribute(u"id", atomId, IZBlogAppNamespaces.ATOM_PUBLISHER_NAMESPACE) #$NON-NLS-1$ for (catId, catName) in wlwBlogInfo.categories: category = ZCategory() category.setId(catId) category.setName(catName) blog.addCategory(category) account.addBlog(blog) # CANNOT CREATE MEDIA STORES HERE: as it needs mediastore service - which is not started until after # profile has started (i.e. after profile manager) # This part of the code needs to be run after the app has started. return account