def getTextDBDictRepr(self): """ Article.getTextDBDictRepr Return a string representing the data (=header+body) in the TextDBDict format. """ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ header = Header( errors = self.errors ) header.setData( self.articledata.headerdata ) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ body = Body( errors = self.errors, logotherasdata = self.logotherasdata ) body.setData( self.articledata.bodydata ) return header.getTextDBDictRepr() + \ body.getTextDBDictRepr()
def initFromStr(self, informationsdata, str_header, str_body, reading_position, artiname_prefix, srclanguage, do_not_normalize): """ Article.initFromStr informationsdata : InformationsData object str_header, str_body : list of strings """ self.reset() self.reading_position = reading_position self.artiname_prefix = artiname_prefix # header : new_header = Header(errors = self.errors) new_header = new_header.initFromStr( src = str_header, reading_position = self.reading_position, artiname_prefix = self.artiname_prefix, srclanguage = srclanguage, do_not_normalize = do_not_normalize) self.articledata.headerdata = new_header.headerdata # body : new_body = Body(errors = self.errors, logotherasdata = self.logotherasdata) new_body.initFromStr( informationsdata = informationsdata, src = str_body, reading_position = self.reading_position, srclanguage = srclanguage) self.articledata.bodydata = new_body.bodydata return self