#15320: staticfiles allows change of storage backend on collection but not when
searching for files
----------------------------------------+-----------------------------------
Reporter: imbaczek@… | Owner:
Status: new | Milestone: 1.3
Component: django.contrib.staticfiles | Version: 1.2
Keywords: | Triage Stage: Unreviewed
Has patch: 0 |
----------------------------------------+-----------------------------------
the culprits are:
finders.py:
{{{
64 for prefix, root in self.locations:
65 filesystem_storage = FileSystemStorage(location=root)
}}}
i need the FileSystemFinder to think that some files are always modified
(i want to use them as overrides for a simple skin system.)
here's the storage i'm want to use (in django 1.2 and backported
staticfiles, but everything is still applicaple):
{{{#!python
import os.path
from datetime import datetime
from django.conf import settings
from staticfiles.storage import StaticFileStorage
class SkinAwareStorage(StaticFileStorage):
def __init__(self, *args, **kwargs):
super(SkinAwareStorage, self).__init__(*args, **kwargs)
def modified_time(self, name):
'''Always return current time for non-default skins'''
p = self.path(name)
if p.startswith(os.path.join(settings.STATIC_ROOT, 'skins')) \
and not p.startswith(os.path.join(settings.STATIC_ROOT,
'skins', 'default')):
return datetime.now()
else:
return super(SkinAwareStorage, self).modified_time(name)
}}}
my suggestion: a STATICFILES_FINDER_STORAGE settings parameter.
--
Ticket URL: <http://code.djangoproject.com/ticket/15320>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.