comparison piecrust/data/assetor.py @ 329:422052d2e978

internal: Try handling URLs in a consistent way. * Now URLs passed to, and returned from, routes will always be absolute URLs, i.e. URLs including the site root. * Validate the site root at config loading time to make sure it starts and ends with a slash. * Get rid of unused stuff. * Add tests.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 31 Mar 2015 23:03:28 -0700
parents 9f3fc17e71e1
children 0e9a94b7fdfa
comparison
equal deleted inserted replaced
328:2a5996e0d3ec 329:422052d2e978
24 base_url = multi_replace( 24 base_url = multi_replace(
25 base_url_format, 25 base_url_format,
26 { 26 {
27 '%path%': rel_assets_path, 27 '%path%': rel_assets_path,
28 '%uri%': uri}) 28 '%uri%': uri})
29 # TEMP HACK 29
30 # TODO: looks like we can get here with differently formatted URLs... :( 30 return base_url.rstrip('/') + '/'
31 return app.config.get('site/root') + base_url.strip('/') + '/'
32 31
33 32
34 class Assetor(object): 33 class Assetor(object):
35 ASSET_DIR_SUFFIX = '-assets' 34 ASSET_DIR_SUFFIX = '-assets'
36 35