def get(self): """Return the raw HTML contents of requested exercise file. Note that we don't set any cache headers for this static response, because we frequently push bug fixes for these files and want them to be updated immediately. Letting downstream caches hold our content would also cause problems for the a/b tests in exercises.file_experiments. """ path = self.request.path filename = urllib.unquote(path.split('/', 3)[3]) # enter the user into the metacognitive experiment, if appropriate filename = self.metacog_filename_map(filename) # NOTE Any file_experiments will be performed on the control version # of this exercise, which has its filename unchanged. Need to watch out # for file_experiments when interpreting the data. # If this exercise is in an experiment, get the current user's possibly # modified filename for their exercise content alternative. file_experiment = file_experiments.get_experiment(filename) if file_experiment: filename = file_experiment.filename_for_current_user() language = self.request_language_tag() contents = file_contents.raw_exercise_contents(filename, language) self.response.headers["Content-Type"] = "text/html" self.response.out.write(contents)
def get(self): path = self.request.path exercise_file = urllib.unquote(path.rpartition('/')[2]) self.response.headers["Content-Type"] = "text/html" self.response.out.write(raw_exercise_contents(exercise_file))