def assemble(self,row): if row: article=Article() article.id=row[0] article.title=row[1] article.originId=row[2] article.providerId=row[3] article.isEnglish=row[4] article.content=row[5] article.subType=row[6] article.type=row[7] article.allType=row[8] article.ipnewsCategory=row[9] article.proDate=row[10] if article.subType == 1: article.contentType=Article.CONTENT_TYPE_NEWLAW#每日快讯(新法快报) elif article.subType==3 and article.ipnewsCategory==1: article.contentType=Article.CONTENT_TYPE_HOTNEWS#评论文章 elif article.subType==4: article.contentType=Article.CONTENT_TYPE_PRACTICAL#实用资料 elif article.subType==6: article.contentType=Article.CONTENT_TYPE_ELEARNING#在线培训 elif article.subType==7: article.contentType=Article.CONTENT_TYPE_TPOVERVIEW else: article.contentType=Article.CONTENT_TYPE_OTHERS return article
def generatorAssemble(self,row): if row: article=Article() article.id=row[0] article.title=row[1] article.originId=row[2] article.providerId=row[3] article.isEnglish=row[4] article.content=row[5] article.subType=row[6] article.type=row[7] article.allType=row[8] article.ipnewsCategory=row[9] article.proDate=row[10] if article.subType == 1: article.contentType=Article.CONTENT_TYPE_NEWLAW#每日快讯(新法快报) yield article elif article.subType==3: article.contentType=Article.CONTENT_TYPE_HOTNEWS#评论文章 yield article elif article.subType==4: article.contentType=Article.CONTENT_TYPE_PRACTICAL#实用资料 yield article elif article.subType==6: article.contentType=Article.CONTENT_TYPE_ELEARNING#在线培训 yield article elif article.subType==7: for topicId in article.allType.split(','): article.contentType=self.overviewType[topicId] yield article else: article.contentType=Article.CONTENT_TYPE_OTHERS yield article