Exemple #1
0
def __addDoctoTable(doc):    
    rows=tablemerge.getRecordsByNewsid(dbconfig.mergetable, doc.uid)
    if rows==-1:
        print 'tablemerge getRecordsById error'
        return
    if len(rows[0])>0:
        exrecord=list(rows[0][:1]+rows[0][2:-1])
        related=''
        exrecord+=[related,]  
        tablemerge2.InsertItem(dbconfig.mergetable2, exrecord)    
def _getRequestInfosfromMerge2Record(record,requestime):
    #0id,1webid/mtid,2url,3title,4newsid,5thumb,6summary,7keywords,8ctime,9source,
    #10author,11description,12mtype,13click/related        
    #4newsid,3title,2url,5thumb,6brief,9source,8ctime,10author,11description,12mtype,13click/related
    related=[]
    relnewsids=record[13].split(',')
    for relnewsid in relnewsids:
        if not relnewsid:
            continue
        relrecord=tablemerge.getRecordsByNewsid(dbconfig.mergetable,relnewsid)
        if not relrecord:
            continue
        relrecord=relrecord[0] 
        related.append(NewsInfo(relrecord[4],relrecord[3],relrecord[2],relrecord[5],relrecord[6],relrecord[9],
                                relrecord[8],relrecord[10],relrecord[11],relrecord[12],[],relrecord[13]))                                
    return RequestInfo(record[4],record[3],record[2],record[5],record[6],record[9],record[8],
                            record[10],record[11],record[12],related,0,requestime)
Exemple #3
0
def _getInfosfromMerge2Records(records):
    nInfos=[]
    for item in records:
    #0id,1webid/mtid,2url,3title,4newsid,5thumb,6summary,7keywords,8ctime,9source,
    #10author,11description,12mtype,13click/related        
    #4newsid,3title,2url,5thumb,6brief,9source,8ctime,10author,11description,12mtype,13click/related
        related=[]
        relnewsids=item[13].split(',')
        for relnewsid in relnewsids:
            if not relnewsid:
                continue
            relitem=tablemerge.getRecordsByNewsid(mergetable,relnewsid)
            if not relitem:
                continue
            relitem=relitem[0] 
            related.append(NewsInfo(relitem[4],relitem[3],relitem[2],relitem[5],relitem[6],relitem[9],
                                    relitem[8],relitem[10],relitem[11],relitem[12],[],relitem[13]))                                
        nInfos.append(NewsInfo(item[4],item[3],item[2],item[5],item[6],item[9],item[8],
                                item[10],item[11],item[12],related,0)) 
    return nInfos