debugtools/utils/xview.py
def get_used_template(response):
    """
    Get the template used in a TemplateResponse.
    This returns a tuple of "active choice, all choices"
    """
    if not hasattr(response, 'template_name'):
        return None, None

    template = response.template_name
    if template is None:
        return None, None

    if isinstance(template, (list, tuple)):
        # See which template name was really used.
        if len(template) == 1:
            return template[0], None
        else:
            used_name = _get_used_template_name(template)
            return used_name, template
    elif isinstance(template, six.string_types):
        # Single string
        return template, None
    else:
        # Template object.
        filename = _get_template_filename(template)
        template_name = '<template object from {0}>'.format(filename) if filename else '<template object>'
        return template_name, None
def get_used_template(response):
    if not hasattr(response, 'template_name'):
        return None, None

    template = response.template_name
    if template is None:
        return None, None

    if isinstance(template, (list, tuple)):
        # See which template name was really used.
        if len(template) == 1:
            return template[0], None
        else:
            used_name = _get_used_template_name(template)
            return used_name, template
    elif isinstance(template, six.string_types):
        # Single string
        return template, None
    else:
        # Template object.
        filename = _get_template_filename(template)
        template_name = '<template object from {0}>'.format(filename) if filename else '<template object>'
        return template_name, None
def get_used_template ( response ) : if not hasattr ( response , 'template_name' ) : return None , None template = response . template_name if template is None : return None , None if isinstance ( template , ( list , tuple ) ) : # See which template name was really used. if len ( template ) == 1 : return template [ 0 ] , None else : used_name = _get_used_template_name ( template ) return used_name , template elif isinstance ( template , six . string_types ) : # Single string return template , None else : # Template object. filename = _get_template_filename ( template ) template_name = '<template object from {0}>' . format ( filename ) if filename else '<template object>' return template_name , None
Get the template used in a TemplateResponse.
    This returns a tuple of "active choice, all choices"
Get the template used in a TemplateResponse . This returns a tuple of active choice all choices