示例#1
0
    def _render_assets(self, filter, output, files, caller=None):
        if not settings.ASSETS_DEBUG:
            merged_url = get_merged_url(files, output, filter)
            if merged_url:
                return caller(merged_url)

        # At this point, either ASSETS_DEBUG is enabled, or
        # ``get_merged_url`` returned False, in both cases we render
        # the source assets.
        result = u""
        for f in get_source_urls(files):
            result += caller(f)
        return result
示例#2
0
    def render(self, context):
        output, files, filter = self.resolve(context)

        if not settings.ASSETS_DEBUG:
            merged_url = get_merged_url(files, output, filter)
            if merged_url:
                context.update({'ASSET_URL': merged_url})
                try:
                    result = self.childnodes.render(context)
                finally:
                    context.pop()
                return result

        # At this point, either ASSETS_DEBUG is enabled, or
        # ``get_merged_url`` returned False, in both cases we render
        # the source assets.
        result = u""
        for source in get_source_urls(files):
            context.update({'ASSET_URL': source})
            try:
                result += self.childnodes.render(context)
            finally:
                context.pop()
        return result