From: Stephen Burrows Date: Tue, 5 Oct 2010 21:49:12 +0000 (-0400) Subject: Minor bugfix: moved ConstantEmbedNode DoesNotExist reraising so that it actually... X-Git-Tag: philo-0.9~30^2^2 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/77491cf6fbc97ab4b37c550a42dc673d55f044fa?ds=sidebyside Minor bugfix: moved ConstantEmbedNode DoesNotExist reraising so that it actually reraises the DoesNotExist exception. --- diff --git a/templatetags/embed.py b/templatetags/embed.py index c0fcff0..8fb240d 100644 --- a/templatetags/embed.py +++ b/templatetags/embed.py @@ -21,15 +21,11 @@ class ConstantEmbedNode(template.Node): if object_pk is not None: self.compile_instance(object_pk) - if self.instance is False and settings.TEMPLATE_DEBUG: - raise else: self.instance = None if template_name is not None: self.compile_template(template_name[1:-1]) - if self.template is False and settings.TEMPLATE_DEBUG: - raise else: self.template = None @@ -39,12 +35,18 @@ class ConstantEmbedNode(template.Node): try: self.instance = model.objects.get(pk=object_pk) except model.DoesNotExist: + if not hasattr(self, 'object_pk') and settings.TEMPLATE_DEBUG: + # Then it's a constant node. + raise self.instance = False def compile_template(self, template_name): try: self.template = template.loader.get_template(template_name) except template.TemplateDoesNotExist: + if not hasattr(self, 'template_name') and settings.TEMPLATE_DEBUG: + # Then it's a constant node. + raise self.template = False def render(self, context):