Issue #28 resolved

sort out inclusion renderer/extension issues

faassen
created an issue

There was a bit of a mess going on involving extensions and inclusion renderers, meaning that an inclusion renderer can be defined for an extension that isn't acceptable and vice versa. This needs to be sorted out and the API for inclusion renderers needs to be cleaned up.

Comments (5)

  1. Jan-Jaap Driessen

    Agreed. In our application code we are jumping through great hoops in order to render a print style sheet:

    def render_print_css(url):
        return (
            '<link rel="stylesheet" type="text/css" '
            'media="print" href="%s.css" />' % url)
    
    from fanstatic.core import inclusion_renderers, EXTENSIONS
    # Files that have a ".print" file name extension are treated
    # differently from files that have a ".css" file name extension.
    inclusion_renderers['.print'] = render_print_css
    EXTENSIONS.insert(1, '.print')
    
  2. Jan-Wijbrand Kolman
    • changed status to open

    We simplified extending the inclusion renderers in 7d23db1e4a51 . It is now possible to either insert a (extension, renderer) tuple into the fanstatic.inclusion_renderers list or pass a custom renderer callable when instantiating a Resource object.

  3. Log in to comment