Exemple #1
0
 def calc_context(self, context):
     """If we have a script, run it, and return the resulting context."""
     if self.script:
         # Seed the random number for the student
         if not self.seed:
             self.set_student_seed()
         random.seed(self.seed)
         script_vals = run_script(self.script)
         context = dict(context)
         context.update(script_vals)
     return context
 def calc_context(self, context):
     """If we have a script, run it, and return the resulting context."""
     if self.script:
         # Seed the random number for the student
         if not self.seed:
             self.set_student_seed()
         random.seed(self.seed)
         script_vals = run_script(self.script)
         context = dict(context)
         context.update(script_vals)
     return context