def get_data(self,qd): _data = [] msg_log = trimming_log('msglog') seq_num = int(qd['seq_num']) data = msg_log[seq_num + 1:] increment = 1 index = 0 end = len(data) if string.lower(qd['sort_order']) == 'descending': increment = -1 index = len(data)-1 end = -1 type = 'all' application = 'all' if qd.has_key('type'): type = qd['type'] if qd.has_key('application'): application = qd['application'] while index != end: if type == 'all' and application == 'all': _data.append(data[index]) elif type == 'all' and application != 'all': if re.match(application,data[index]['application']): _data.append(data[index]) elif application == 'all' and type != 'all': if re.match(type,data[index]['type']): _data.append(data[index]) elif application != 'all' and type != 'all': if re.match(application,data[index]['application']) and re.match(type,data[index]['type']): _data.append(data[index]) index += increment return _data
def get_msglog(self, last_seq, size): msg_log = trimming_log("msglog") start = last_seq if last_seq == 0: start = msg_log.get_first_record()["_seq"] end = start + size _data = msg_log.get_range("_seq", start, end, 1) data = [] for d in _data: data.append(d) return data
def handle(self,request): msg_log = trimming_log('msglog') sort_order = 'descending' column = '_seq' end = len(msg_log) start = end - 25 type = 'all' application = 'all' parameters = {} response = Response(request) parameters = request.get_query_dictionary() if parameters: if parameters.has_key('column'): column = parameters['column'] if parameters.has_key('start'): start = parameters['start'] if parameters.has_key('end'): end = parameters['end'] if parameters.has_key('type'): type = parameters['type'] if parameters.has_key('application'): application = parameters['application'] if parameters.has_key('sort_order'): sort_order = parameters['sort_order'] data = msg_log.get_range(column, float(start), float(end), 1) children = [] index = 0 increment = 1 end = len(data) if column == '_seq': if string.upper(sort_order) == 'DESCENDING': increment = -1 index = len(data) -1 end = -1 while index != end: current_index = index child = entry_factory(data[index]) index = child.feed(data,index,increment) if current_index == index: index += increment children.append(child) formatter = HTMLFormatter(children) response.send(formatter.output(type,application,sort_order))
def handle(self, request): msg_log = trimming_log('msglog') sort_order = 'descending' column = '_seq' end = len(msg_log) start = end - 25 type = 'all' application = 'all' parameters = {} response = Response(request) parameters = request.get_query_dictionary() if parameters: if parameters.has_key('column'): column = parameters['column'] if parameters.has_key('start'): start = parameters['start'] if parameters.has_key('end'): end = parameters['end'] if parameters.has_key('type'): type = parameters['type'] if parameters.has_key('application'): application = parameters['application'] if parameters.has_key('sort_order'): sort_order = parameters['sort_order'] data = msg_log.get_range(column, float(start), float(end), 1) children = [] index = 0 increment = 1 end = len(data) if column == '_seq': if string.upper(sort_order) == 'DESCENDING': increment = -1 index = len(data) - 1 end = -1 while index != end: current_index = index child = entry_factory(data[index]) index = child.feed(data, index, increment) if current_index == index: index += increment children.append(child) formatter = HTMLFormatter(children) response.send(formatter.output(type, application, sort_order))
def get_data(self, qd): _data = [] msg_log = trimming_log('msglog') seq_num = int(qd['seq_num']) data = msg_log[seq_num + 1:] increment = 1 index = 0 end = len(data) if string.lower(qd['sort_order']) == 'descending': increment = -1 index = len(data) - 1 end = -1 type = 'all' application = 'all' if qd.has_key('type'): type = qd['type'] if qd.has_key('application'): application = qd['application'] while index != end: if type == 'all' and application == 'all': _data.append(data[index]) elif type == 'all' and application != 'all': if re.match(application, data[index]['application']): _data.append(data[index]) elif application == 'all' and type != 'all': if re.match(type, data[index]['type']): _data.append(data[index]) elif application != 'all' and type != 'all': if re.match(application, data[index]['application']) and re.match( type, data[index]['type']): _data.append(data[index]) index += increment return _data