class Quiz (list):
- def __init__(self, questions=None, path=None, encoding=None):
+ def __init__(self, introduction=None, questions=None, path=None,
+ encoding=None):
+ self.introduction = introduction
if questions is None:
questions = []
super(Quiz, self).__init__(questions)
if version != __version__:
raise NotImplementedError('upgrade from {} to {}'.format(
version, __version__))
+ self.introduction = data.get('introduction', None)
for state in data['questions']:
question_class_name = state.pop('class', 'Question')
question_class = _question.QUESTION_CLASS[question_class_name]
state['class'] = type(question).__name__
data = {
'version': __version__,
+ 'introduction': self.introduction,
'questions': questions,
}
with self._open(mode='w', **kwargs) as f:
def __init__(self, ui):
super(QuestionCommandLine, self).__init__()
self.ui = ui
+ if self.ui.quiz.introduction:
+ self.intro = '\n\n'.join([self.intro, self.ui.quiz.introduction])
def preloop(self):
self.question = self.ui.get_question()