def load_linked_questions(self, symptom_tag, linked_question_tag=None, serial=None): linked_questions_list = [] data = __import__(symptom_tag).data() if serial is None and linked_question_tag is None: for tag, value in data.iteritems(): linked_questions_list.append( self._build_linked_list(value, tag)) linked_questions_list.sort(key=lambda x: x.serial) elif serial is None and linked_question_tag: # search and load linked question by tag for tag, value in data.iteritems(): if tag == linked_question_tag: linked_questions_list.append( self._build_linked_list(value, tag)) elif linked_question_tag is None and serial: # search by serial for tag, value in data.iteritems(): if value['serial'] == serial: linked_questions_list.append( self._build_linked_list(value, tag)) return linked_questions_list
def load_linked_questions(self, symptom_tag, linked_question_tag=None, serial=None): linked_questions_list = [] data = __import__(symptom_tag).data() if serial == None and linked_question_tag == None: for tag, value in data.iteritems(): linked_questions_list.append(self._build_linked_list(value, tag)) linked_questions_list.sort(key=lambda x: x.serial) elif serial == None and linked_question_tag: # search and load linked question by tag for tag, value in data.iteritems(): if tag == linked_question_tag: linked_questions_list.append(self._build_linked_list(value, tag)) elif linked_question_tag == None and serial: # search by serial for tag, value in data.iteritems(): if value['serial'] == serial: linked_questions_list.append(self._build_linked_list(value, tag)) return linked_questions_list
def load_top_questions(self): from top_questions import data from question_interface import question_interface top_questions_list = [] data = data() for tag, value in data.iteritems(): top = question_interface() top_questions_list.append(self._assign_attributes(top, value, tag)) return top_questions_list