def setUp(self):
     self.this_directory = os.path.dirname(__file__)
     survey_out = Survey(name=u"age", sms_keyword=u"age", type=u"survey")
     question = InputQuestion(name=u"age")
     question.type = u"integer"
     question.label = u"How old are you?"
     survey_out.add_child(question)
     self.survey_out_dict = survey_out.to_json_dict()
     print_pyobj_to_json(self.survey_out_dict, utils.path_to_text_fixture("how_old_are_you.json"))
Exemple #2
0
 def setUp(self):
     survey_out = Survey(type=u"survey")
     question = InputQuestion(name=u"age")
     question.set(InputQuestion.TYPE, u"integer")
     question.set(InputQuestion.LABEL, u"How old are you?")
     survey_out.add_child(question)
     self.survey_out_dict = survey_out.to_dict()
     print_pyobj_to_json(self.survey_out_dict,
                         "pyxform/tests/how_old_are_you.json")
def generate_new_dict():
    """
    This is just here incase there is ever any need to generate the question
    type dictionary from all.xls again.
    It shouldn't be called as part of any application.
    """
    path_to_question_types = "/pyxform/question_types/all.xls"
    json_dict = QuestionTypesReader(path_to_question_types).to_json_dict()
    print_pyobj_to_json(json_dict, "new_question_type_dict.json")
def generate_new_dict():
    """
    This is just here incase there is ever any need to generate the question
    type dictionary from all.xls again.
    It shouldn't be called as part of any application.
    """
    path_to_question_types = "/home/nathan/aptana-workspace/pyxform"\
        "/pyxform/question_types/all.xls"
    json_dict = QuestionTypesReader(path_to_question_types).to_json_dict()
    print_pyobj_to_json(json_dict, 'new_quesiton_type_dict.json')
 def setUp(self):
     self.this_directory = os.path.dirname(__file__)
     survey_out = Survey(name=u"age", type=u"survey")
     question = InputQuestion(name=u"age")
     question.type = u"integer"
     question.label = u"How old are you?"
     survey_out.add_child(question)
     self.survey_out_dict = survey_out.to_json_dict()
     print_pyobj_to_json(self.survey_out_dict,
                         utils.path_to_text_fixture("how_old_are_you.json"))
Exemple #6
0
 def select_zone_state_lga(self):
     survey = Survey(name=u"need_xml_tag")
     survey.set(u"type", u"survey")
     questions = [self.select_zone()] + \
         self.select_state_questions() + \
         self.select_lga_questions()
     for question in questions:
         survey.add_child(question)
     pyobj = survey.to_dict()
     print_pyobj_to_json(pyobj, "zone_state_lga.json")
Exemple #7
0
 def setUp(self):
     survey_out = Survey(
         type=u"survey"
         )
     question = InputQuestion(name=u"age")
     question.set(InputQuestion.TYPE, u"integer")
     question.set(InputQuestion.LABEL, u"How old are you?")
     survey_out.add_child(question)
     self.survey_out_dict = survey_out.to_dict()
     print_pyobj_to_json(self.survey_out_dict, "pyxform/tests/how_old_are_you.json")
Exemple #8
0
 def json_dump(self, path=""):
     if not path:
         path = self.name + ".json"
     print_pyobj_to_json(self.to_json_dict(), path)
 def json_dump(self, path=""):
     if not path:
         path = self.name + ".json"
     print_pyobj_to_json(self.to_json_dict(), path)