def get_data_row_format(self, input_current, MAX_NUM_NODES=6): # input_current is number or Collection if is_number(input_current): current = self.get_collection_with_id(input_current) elif is_collection(input_current): current = input_current else: return None parents = self.get_all_parents_of_collection(current.id) # get all parent nodes and current node if len(parents) > 0: nodes = parents + [current] else: nodes = [current] # >> prepare data (same order as headers) data_row = [] # append string of node info data_row = [hf.format_collection_id_and_name(node.id, node.name) for node in nodes] # pad with empty string until the length is MAX_num_nodes data_row = data_row + ( [''] * (MAX_NUM_NODES-len(data_row)) ) data_row.append(current.slug) data_row.append(current.is_category) return data_row
def set_dropdown_inputs(dropdown, collections): dropdown.args = [] # clear if len(collections): assert is_collection(collections[0]) dropdown.args = [ hf.format_collection_id_and_name(c.id, c.name) for c in collections] print 'value:', dropdown.get_value()