Esempio n. 1
0
def post(name): 
    global WALLPOST
    global USER_POST
    print "in post ........"
    #file = open('conf.txt', 'r')
    file = open('file.txt', 'r',5000)
    print "read 5000 line in to the momeory from file.txt........"#,time.asctime()    
    ctr=0
    count=0
    LINE_NUMBER=0
    for line in file:
        
        ctr=ctr+1
        LINE_NUMBER= LINE_NUMBER +1
        ######print "line is:",line
        match = line.split(' ', 1) 
        #####print match[0],"------->",match[1]
        
        if match[0] in 'wallpost':     
                WALLPOST[str(ctr)]={}
                #####print 'in wallpost(), val is ',val
                MATCH= match[1].split(' ',1)
                #####print 'user is',MATCH[0]
                post= MATCH[1].split('\n',1)
                WALLPOST[str(ctr)]['body']=post[0][1:-1]
                WALLPOST[str(ctr)]['userid']=MATCH[0]
                
                if MATCH[0] not in USER_POST.keys():
                    USER_POST[MATCH[0]]={}
                    USER_POST[MATCH[0]]['postid_set']=str()
                    
                USER_POST[MATCH[0]]['postid_set']+=','+(str(ctr))
                
                count=count+1
                ##print 'post, usr is:',MATCH[0]
                if count == 5000:                    
                    count=0
                    client.placework(dispatcher,LINE_NUMBER-5000, 5000)
                    #WALLPOST.clear()
         
    if count>0:
        client.placework(dispatcher,LINE_NUMBER-count, count)                
Esempio n. 2
0
def post(name): 
    
    print "in post ........"
    #file = open('conf.txt', 'r')
    file = open('file.txt', 'r',5000)
    print "read 5000 line in to the momeory from file.txt........"
    WALLPOST={}
    ctr=0
    count=0
    LINE_NUMBER=0
    for line in file:
        
        ctr=ctr+1
        LINE_NUMBER= LINE_NUMBER +1
        ######print "line is:",line
        match = line.split(' ', 1) 
        #####print match[0],"------->",match[1]
        
        if match[0] in 'wallpost':     
                WALLPOST[str(ctr)]={}
                #####print 'in wallpost(), val is ',val
                MATCH= match[1].split(' ',1)
                #####print 'user is',MATCH[0]
                post= MATCH[1].split('\n',1)
                WALLPOST[str(ctr)]['body']=post[0][1:-1]
                WALLPOST[str(ctr)]['userid']=MATCH[0]
                
                
                
                count=count+1
                ##print 'post, usr is:',MATCH[0]
                if count == 5000:                    
                    count=0
                    client.placework(LINE_NUMBER-5000, 5000)
                    #WALLPOST.clear()
         
    client.placework(LINE_NUMBER-count, count)                
    user_frnd(1)