Opened 14 years ago
Closed 12 years ago
#15562 closed New feature (wontfix)
include_patterns in staticfiles finder
Reported by: | German M. Bravo | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 1.3-rc |
Severity: | Normal | Keywords: | |
Cc: | German M. Bravo | Triage Stage: | Design decision needed |
Has patch: | no | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
For completeness and also to be able to include only files like *.gif or the like, I've added include_patterns to the list() method in the staticfiles finders. I'm attaching a patch for that.
Attachments (2)
Change History (11)
by , 14 years ago
Attachment: | #15562-include_patterns.diff added |
---|
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Version: | 1.2 → 1.3-rc1 |
---|
comment:3 by , 14 years ago
Component: | Uncategorized → django.contrib.staticfiles |
---|---|
Summary: | include_patterns in static files finder → include_patterns in staticfiles finder |
comment:4 by , 14 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Closing needsinfo -- there might be an interesting idea in here, but as Jannis points out, it isn't obvious. The proposed change adds features to an undocumented private API without any obvious public benefit.
Feel free to reopen and elaborate if you feel we have missed something.
comment:5 by , 13 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
comment:6 by , 13 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → reopened |
I'll elaborate a bit about what I use this for and reopen the ticket as I believe it could be useful for other things as well and it's also elegant and brings symmetry in the code.
I'm using the template system to produce my CSS files, some CSS files I keep in the database with a personalized template loader, some others are in the filesystem. Nonetheless, I also use a CSS compiler (pyScss) to process the produced CSS files. The way I use the include_patterns
is in a function I call finder()
, which I use to request some given template file(s) in a glob (no matter if it's in the database or the filesystem), finder()
returns all the templates that match the given glob, returning the path (if available) and the storage, the same I later use to consistently open and read each file:
from django.contrib.staticfiles import finders def finder(glob): for finder in finders.get_finders(): for path, storage in finder.list([], [glob]): yield path, storage
comment:7 by , 13 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Design decision needed |
Type: | Uncategorized → New feature |
comment:8 by , 12 years ago
Status: | reopened → new |
---|
comment:9 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I'm sorry, but this doesn't sound like a common use case for Django, and you're using the API for something that's quite far from its goals.
The finder API is currently considered private API, so can you elaborate on the use of this feature? From what I can see it isn't hooked up with any user facing feature.