Made filename generator configurable #22

Merged
merged 3 commits into from Sep 20, 2012

2 participants

@girasquid

We wanted our filenames to use something other than the timestamp.

@peterbe

Can you please change this to a getattr instead of the big try:except block. Reason being is that something else might raise an AttributeError by mistake and it gets confused with the AttributeError of fetching settings.DJANGO_STATIC_FILENAME_GENERATOR.

Please replace the try:except with:

  filename_generator = getattr(settings, 'DJANGO_STATIC_FILENAME_GENERATOR', None)
  if filename_generator:
      return filename_generator

   def default_filename_generator(apart, new_m_time):
        ...
   return default_filename_generator

"default" is better than "old" because that's what it is. It's only "old" to you :)

@peterbe
Owner

I can't merge this until you provide a unit test that checks it. If you need help writing one I'm more than happy to help out. Let me know.

Owner

By the way, I forgot to say; I love the idea!
Also, it would really help me accept this if you add a note in the README about being able to set DJANGO_STATIC_FILENAME_GENERATOR

Will do.

@girasquid

I'm a bit lost on how to write a test for this - can you help me out with that?

@peterbe
Owner

Sorry for late reply. Been busy. I'll try to see if I can send a pull request your way towards this when I find time. My september is being butchered by lots of other commitments.

@peterbe peterbe merged commit 070029a into peterbe:master Sep 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment