def _loadData(self, onlyActive=True, identity=None): if identity: if onlyActive: blogs = Weblog.select( AND( Weblog.q.isActive==True, Weblog.q.identityID==identity.id ), orderBy='name' ) else: blogs = Weblog.select(Weblog.q.identityID==identity.id, orderBy='name') else: if onlyActive: blogs = Weblog.select(Weblog.q.isActive==True, orderBy='name') else: blogs = Weblog.select(orderBy='name') for blog in blogs: self.model.append(( blog.name, blog.weblogID, str(blog.isActive), blog ))
def _updateBlogData(self, blogName, blogID): try: blog = Weblog.byName(blogName) blog.weblogID = blogID except SQLObjectNotFound: blog = Weblog(name=blogName, identity=self.identity, weblogID=blogID)
def _fillList(self): self.model.clear() if self.entry: publications = self.entry.publications blogs = [] for publication in publications: self.model.append(( False, publication.weblog.name, publication.weblog.identity.name, publication.weblog, )) else: blogs = Weblog.select(Weblog.q.isActive==True, orderBy='name') for blog in blogs: self.model.append(( False, blog.name, blog.identity.name, blog, ))