Created
July 18, 2013 18:04
-
-
Save bmispelon/6031523 to your computer and use it in GitHub Desktop.
Django ticket 20745 Rendering foo.html raises a TypeError whereas bar.html doesn't.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'foo.html' %} | |
{% block foo %} | |
{{ block.super }} | |
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load raise %} | |
{% block foo %} | |
{% raise 'TypeError' %} | |
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import builtins | |
from django import template | |
register = template.Library() | |
@register.simple_tag(name='raise') | |
def do_raise(exception_name, msg=None): | |
exception_type = getattr(builtins, exception_name) | |
args = (msg,) if msg is not None else () | |
raise exception_type(*args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment