Exemplo n.º 1
0
 def __CheckDnspodInfo(self):
     sql = self.forms['dnspod_info']['select']
     origin_data = yield Task(self.db.select, sql, account_id='%')
     table_name = [
         'account_id', 'account_name', 'd_format', 'ttl', 'default_line',
         'token_id', 'token'
     ]
     dict_info = sqlZip(table_name, origin_data)
     raise Return(dict_info)
Exemplo n.º 2
0
 def get(self):
     origin_json = dict()
     try:
         origin_json['zid'] = self.get_argument('zid') or '%'
         origin_sql = self.forms['record_zones']['select']
         origin_data = yield Task(self.db.select, origin_sql, origin_json)
         table_name = ['zid', 'domain_name', 'zgid', 'description']
         data_list = sqlZip(table_name, origin_data)
         message = {"status": True, "message": data_list}
     except:
         message = {"status": False, "message": "params not found."}
     self.write(convJson(message))
Exemplo n.º 3
0
    def get(self):
        origin_json = dict()
        origin_json['zgid'] = self.get_argument('zgid') or '%'
        origin_sql = self.forms['zone_groups']['select']
        origin_data = yield Task(self.db.select, origin_sql, **origin_json)
        table_name = ['zgid', 'group_name', 'description']
        data_list = sqlZip(table_name, origin_data)
        #data_list = map(lambda x: dict(zip(table_name, x)), origin_data)
        message = {"status": True, "message": data_list}

        #try:
        #except:
        #    message = {"status": False, "message": "params not found."}
        self.write(convJson(message))
Exemplo n.º 4
0
 def get(self):
     origin_json = self.request.arguments
     data =dict()
     status = str()
     result = dict()
     try:
         if not origin_json.has_key('zid'):
             sql_select_zid = "select zid from record_zones where zone_name = %(zone_name)s;"
             tuple_data =yield Task(self.db.select, sql_select_zid, zone_name=origin_json['zone_name'][0])
             data['zid'] = str(tuple_data[0][0])
         else:
             data['zid'] = origin_json['zid'][0] or '%'
         origin_sql = self.forms['record_list']['select_by_zid']
         table_name = ['rid','sub_domain','record_type','value','ttl','weight','mx','record_line','status','zid','rgid','description']
         origin_data = yield Task(self.db.select, origin_sql, **data)
         data_list = sqlZip(table_name, origin_data)
         status = True
         result['records'] = data_list
     except:
         status = False
         result['message'] = "params not found."
     result['status'] = status
     self.write(convJson(result))
Exemplo n.º 5
0
 def get(self):
     sql = "select * from record_aqb_view;"
     aqb_table = [
         "rid", "sub_domain", "value", "record_type", "zone_name", "status",
         "url"
     ]
     kw = dict()
     sql_tuple = yield Task(self.db.select, sql, **kw)
     to_redis = dict()
     to_web = list()
     tuple_que = list()
     for tup in range(len(sql_tuple)):
         s = bool()
         tu = list(sql_tuple[tup])
         if to_redis.has_key(tu[0]): s = True
         if not to_redis.has_key(tu[0]):
             to_redis[tu[0]] = list()
         to_redis[tu[0]].append(tu[1])
         if s:
             num = tuple_que.index(int(tu[0]))
             to_web[num][2] = str(to_web[num][2]) + ',' + str(tu[4])
             continue
         #print tu[4] +" "+tu[6]
         if tu[8]:
             # 注意:list删除元素后长度缩短1
             del tu[6]
             del tu[4]
         else:
             del tu[5]
             del tu[3]
         del tu[1]
         to_web.append(list(tu))
         tuple_que.append(tu[0])
     aqb_list = sqlZip(aqb_table, to_web)
     self.finish(convJson(dict(status=True, records=aqb_list)))
     for key, values in to_redis.items():
         self.redisClient.push('rpush', key, *values)
Exemplo n.º 6
0
 def getPTRList(self, ptrid):
    the_list = yield Task(self.db.select, self.forms['ptr_zones']['select_like'], ptrid=ptrid)
    the_table = ['ptrid','name','zone','description']
    raise Return(sqlZip(the_table, the_list))
Exemplo n.º 7
0
 def checkOlderRecordByRid(self, record_dict):
     older_table = ['rid','sub_domain','record_type','value','ttl','weight','mx','record_line','status','zid','rgid','description']
     older_tuple = yield Task(self.db.select, self.forms['record_list']['select_rid'], rid=record_dict['rid'])
     older = sqlZip(older_table, older_tuple)[0] if len(older_tuple) else list()
     raise Return(older)