Example #1
0
 def make_asset_url(self, rel_url):
     """Builds a full URL based the given relative URL."""
     if self.settings['enable_static_compilation']:
         prefix = self.settings['static_url_prefix']
     elif self.local:
         prefix = self.settings.get('local_cdn_url_prefix')
     else:
         prefix = get_shard_from_list(self.settings['cdn_url_prefix'], os.path.basename(rel_url))
     return prefix.rstrip('/') + '/' + rel_url.lstrip('/')
Example #2
0
 def make_asset_url(self, rel_url):
     """Builds a full URL based the given relative URL."""
     if self.settings['enable_static_compilation']:
         prefix = self.settings['static_url_prefix']
     elif self.local:
         prefix = self.settings.get('local_cdn_url_prefix')
     else:
         prefix = get_shard_from_list(self.settings['cdn_url_prefix'], os.path.basename(rel_url))
     return prefix.rstrip('/') + '/' + rel_url.lstrip('/')
Example #3
0
 def replacer(match):
     prefix, rel_path = match.groups()
     path = make_relative_static_path(static_dir, rel_path)
     if path in manifest.assets:
         versioned_path = manifest.assets[path]['versioned_path']
         if isinstance(replacement_prefix, (list, tuple)):
             prefix = get_shard_from_list(replacement_prefix, versioned_path)
         else:
             prefix = replacement_prefix
         return prefix.rstrip('/') + '/' + versioned_path.lstrip('/')
     logging.warn('Missing path %s in manifest, using %s', path, match.group(0))
     return match.group(0)
Example #4
0
 def replacer(match):
     prefix, rel_path = match.groups()
     path = make_relative_static_path(static_dir, rel_path)
     if path in manifest.assets:
         versioned_path = manifest.assets[path]['versioned_path']
         if isinstance(replacement_prefix, (list, tuple)):
             prefix = get_shard_from_list(replacement_prefix, versioned_path)
         else:
             prefix = replacement_prefix
         replacement_link = prefix.rstrip('/') + '/' + versioned_path.lstrip('/')
         logging.info('replacing %s -> %s', path, replacement_link)
         return replacement_link
     logging.warn('Missing path %s in manifest, using %s', path, match.group(0))
     return match.group(0)