def get_common_objects(self): super().get_common_objects() self.get_summary_submissions() self.templates = [] for url,name in self.exercise.get_templates(): response = request_for_response(url) self.templates.append({ 'name': name, 'content': response.text, 'html': 'text/html' in response.headers.get('Content-Type'), }) self.note('templates')
def get_common_objects(self): super().get_common_objects() self.get_summary_submissions() self.models = [] for url,name in self.exercise.get_models(): try: response = request_for_response(url) except RemotePageNotFound: self.models.append({'name': name}) else: self.models.append({ 'name': name, 'content': response.text, 'html': 'text/html' in response.headers.get('Content-Type'), }) self.note('models')
def get_common_objects(self): super().get_common_objects() self.get_summary_submissions() id = self.exercise.course_instance.id self.templates = [] for url, name in self.exercise.get_templates(): try: response = request_for_response(url, instance_id=id) response.encoding = "UTF-8" except RemotePageNotFound as error: self.templates.append({'name': name}) else: self.templates.append({ 'name': name, 'content': response.text, 'html': 'text/html' in response.headers.get('Content-Type'), }) self.note('templates')