def __call__(self, value):
		try:
			self.validate_template(value)
		except __HOLE__:
			raise
		except Exception, e:
			if hasattr(e, 'source') and isinstance(e, TemplateSyntaxError):
				origin, (start, end) = e.source
				template_source = origin.reload()
				upto = 0
				for num, next in enumerate(linebreak_iter(template_source)):
					if start >= upto and end <= next:
						raise ValidationError(mark_safe("Template code invalid: \"%s\" (%s:%d).<br />%s" % (escape(template_source[start:end]), origin.loadname, num, e)))
					upto = next
			raise ValidationError("Template code invalid. Error was: %s: %s" % (e.__class__.__name__, e))
dataset/ETHPy150Open ithinksw/philo/philo/validators.py/TemplateValidator.__call__