Glob pattern does not work #31

Closed
vrischmann opened this Issue Nov 28, 2012 · 3 comments

Projects

None yet

2 participants

@vrischmann

I have a bundle defined like this:

bootstrap_js = Bundle(
  "libs/bootstrap/js/*.js"
)

Since a few days ago (I guess with the new release) the glob is not working, instead of having multiple URLs I get one to "http://localhost:8080/static/libs/bootstrap/js/*.js"

After a quick look in the source code I didn't find an easy fix, but I think it's got something to do with the method FlaskResolver.resolve_source_to_url.

Also, I did a git bisect and it told me the first bad commit is 3d9913f

I'd be happy to provide more info if you want.

@miracle2k
Owner

The problem should be in the search_for_source method: https://github.com/miracle2k/flask-assets/blob/master/src/flask_assets.py#L168

If you could set a breakpoint there and figure out why the incoming item with the pattern is not resolved to a list of multiple files, that would be helpful. What I would expect to happen, from reading the code, is that in line 179, the consider_single_directory call should resolve the glob pattern.

@vrischmann

Ok, I'm not sure what I'm doing wrong with pdb and the breakpoint, but when I define a breakpoint with b flask_assets.py:179 it never breaks.

I used a print instead, and consider_single_directory resolves correctly, I get a list of files.

I did somme digging, in the method resolve_source_to_url, I printed the filename variable at https://github.com/miracle2k/flask-assets/blob/master/src/flask_assets.py#L199 and it prints "libs/bootstrap/js/*.js".

Going higher up, I think there's a problem with the method resolve_contents in webassets's bundle.py file, at https://github.com/miracle2k/webassets/blob/master/src/webassets/bundle.py#L164

The item variable used here is never going to be expanded to the correct path, and the resolve_source_to_url method in FlaskResolver uses this as a filename to get the URL.

@pistolero pistolero pushed a commit to pistolero/flask-assets that referenced this issue Jan 3, 2013
@gvmh gvmh Fixed glob patterns (issue #31) 265b1b1
@miracle2k
Owner

Fixed via #32.

@miracle2k miracle2k closed this Jan 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment