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)

#15562-include_patterns.diff (4.4 KB ) - added by German M. Bravo 14 years ago.
#15562-include_patterns-1.4.diff (5.0 KB ) - added by German M. Bravo 13 years ago.
Patch updated for 1.4

Download all attachments as: .zip

Change History (11)

by German M. Bravo, 14 years ago

comment:1 by Jannis Leidel, 14 years ago

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.

comment:2 by Jannis Leidel, 14 years ago

Version: 1.21.3-rc1

comment:3 by Jannis Leidel, 14 years ago

Component: Uncategorizeddjango.contrib.staticfiles
Summary: include_patterns in static files finderinclude_patterns in staticfiles finder

comment:4 by Russell Keith-Magee, 14 years ago

Resolution: needsinfo
Status: newclosed

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 German M. Bravo, 13 years ago

Cc: German M. Bravo added
Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

by German M. Bravo, 13 years ago

Patch updated for 1.4

comment:6 by German M. Bravo, 13 years ago

Resolution: needsinfo
Status: closedreopened

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 Jannis Leidel, 13 years ago

Needs documentation: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedDesign decision needed
Type: UncategorizedNew feature

comment:8 by Aymeric Augustin, 12 years ago

Status: reopenednew

comment:9 by Aymeric Augustin, 12 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top