示例#1
0
 def render_attrs(self):
     """Returns this asset block's attrs as an HTML string. Includes a
     leading space.
     """
     attrs = ' '.join('%s=%r' % (attr, _utf8(val))
                      for attr, val in self.attrs.iteritems())
     return ' ' + attrs if attrs else ''
示例#2
0
 def render_attrs(self):
     """Returns this asset block's attrs as an HTML string. Includes a
     leading space.
     """
     attrs = ' '.join('%s=%r' % (attr, _utf8(val))
                      for attr, val in self.attrs.iteritems())
     return ' ' + attrs if attrs else ''
示例#3
0
    def __init__(self, rel_url_text, local=False, include_tag=True, src_path=None, settings=None, **attrs):
        """Creates an asset manager from `rel_url_text`, a string which should
        contain space (or newline) separated asset URLs.

        Optional params:

          * local - if True, URLs in rendered output will point at our own
            hosts instead of our CDN.

          * include_tag - if False, the only rendered output will be URLs,
            without full HTML elements (useful, e.g., for mobile app manifests)

          * src_path - an optional annotation for recording where this asset
            manager originated.

        Any extra kwargs will be interpreted as extra HTML params to include
        on the rendered element.
        """
        self.rel_urls = filter(None, _utf8(rel_url_text).split())
        self.local = local
        self.include_tag = include_tag
        self.src_path = src_path
        self.attrs = attrs
        self._manifest = None
        assert settings
        self.settings = settings
        logging.debug('%s URLs: %r', self.__class__.__name__, self.rel_urls)
示例#4
0
    def __init__(self, rel_url_text, local=False, include_tag=True, src_path=None, settings=None, **attrs):
        """Creates an asset manager from `rel_url_text`, a string which should
        contain space (or newline) separated asset URLs.

        Optional params:

          * local - if True, URLs in rendered output will point at our own
            hosts instead of our CDN.

          * include_tag - if False, the only rendered output will be URLs,
            without full HTML elements (useful, e.g., for mobile app manifests)

          * src_path - an optional annotation for recording where this asset
            manager originated.

        Any extra kwargs will be interpreted as extra HTML params to include
        on the rendered element.
        """
        self.rel_urls = filter(None, _utf8(rel_url_text).split())
        self.local = local
        self.include_tag = include_tag
        self.src_path = src_path
        self.attrs = attrs
        self._manifest = None
        assert settings
        self.settings = settings
        logging.debug('%s URLs: %r', self.__class__.__name__, self.rel_urls)