Skip to content

cannot use override_assets with an absolute path #1229

Closed
mmerickel opened this Issue Jan 23, 2014 · 3 comments

3 participants

@mmerickel
Pylons Project member

Maybe this is for good reason, but here's why I want it.

Currently add_static_view doesn't support url generation if you use an absolute path. If you do config.add_static_view('static', '/home/foo/assets'), there's no way to use request.static_url(...) to generate a url to a file in that folder. This is a flaw in add_static_view, but it's solvable if we allow overriding.

However, if we could override assets, then it would work by making a dummy asset spec.

config.add_static_view('static', 'mypkg:external_assets')
config.override_asset(to_override='mypkg:external_assets/', override_with='/home/foo/assets/')

request.static_url('mypkg:external_assets/funny_picture.png')
@marioidival

you try use request.static_url('mypkg:external_assets/whatever.*') ?

@mmerickel
Pylons Project member

I think you're missing the point of my example.

@kamalgill

Would be great to have this land in Pyramid 1.6.

@mmerickel mmerickel closed this in #1252 Nov 18, 2014
@mmerickel mmerickel added this to the 1.6 milestone Feb 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.