Exemple #1
0
def reg_user(user):
    try:
        user = update_loc(user)     
        insert('users', user)
        return user
    except:
        print_err() 
        return None
Exemple #2
0
 def test_convert_media(self):
     try:
         result = convert_media()
     except:
         from lib.utils import print_err
         print_err()
     print "convert "
     print result
     self.assertTrue(result)
     update_task_data_media()
     result = find_one("TaskData", {"_id": self.task_id})
     self.assertTrue(result.get("converd", False))
     self.assertTrue(result.get("entryList")[0].get("converdid", False))
Exemple #3
0
 def test_convert_media(self):
     try: 
       result = convert_media()
     except:
       from lib.utils import print_err
       print_err()
     print "convert "
     print result
     self.assertTrue(result)
     update_task_data_media()
     result = find_one("TaskData", {
         "_id": self.task_id
      } )
     self.assertTrue(result.get("converd", False))
     self.assertTrue(result.get("entryList")[0].get("converdid", False))
Exemple #4
0
def insert_file():        
    for line in file.readlines():
        try:
            list  = find("loupanxinxi", query={'area': line})
            writer = csv.writer(file("/root/excel/"+line+".csv",'wb'))
            writer.writerow(['名称', '电话', '电话', '面积', '小区', '地址'])
            for item in list:
                writer.writerow(
                    [
                        item.get('name'),
                        item.get('phone1'), 
                        item.get('phone2'),
                        item.get('area'),
                        item.get('area_name'),
                        item.get('loc')
                    ]
                )
        except:
            print_err()
Exemple #5
0
        line  = line.split("	")
        if not len(line) > 3:
            line = line.split("	") 
        insert("loupanxinxi",{
            'name': line[0],
            'phone1': line[1],
            'phone2': line[2],
            'area': line[3],
            'area_name': line[4],
            'loc': line[5]
        })
            
    except:
        print '---------------king___________________'
        print line
        print_err()
def insert_file():        
    for line in file.readlines():
        try:
            list  = find("loupanxinxi", query={'area': line})
            writer = csv.writer(file("/root/excel/"+line+".csv",'wb'))
            writer.writerow(['名称', '电话', '电话', '面积', '小区', '地址'])
            for item in list:
                writer.writerow(
                    [
                        item.get('name'),
                        item.get('phone1'), 
                        item.get('phone2'),
                        item.get('area'),
                        item.get('area_name'),
                        item.get('loc')