#17861: Static files cache_key should handle spaces in filenames
-------------------------------------+------------------------
Reporter: milosu | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.staticfiles | Version: 1.4-beta-1
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------
trying migrate my project to the Django 1.4c1, I get the following errors
when running the storagefiles_tests test case:
{{{
======================================================================
ERROR: test_cache_invalidation
(regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\Lib\site-
packages\django_versions\Django-1.4c1\tests\regressiontests\staticfiles_tests\tests.py",
lin
e 118, in setUp
self.run_collectstatic()
File "C:\Python26\Lib\site-
packages\django_versions\Django-1.4c1\tests\regressiontests\staticfiles_tests\tests.py",
lin
e 129, in run_collectstatic
ignore_patterns=['*.ignoreme'], **kwargs)
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\core\management\__init__.py",
line 150, in call
_command
return klass.execute(*args, **defaults)
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\core\management\base.py",
line 232, in execute
output = self.handle(*args, **options)
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\core\management\base.py",
line 371, in handle
return self.handle_noargs(**options)
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\contrib\staticfiles\management\commands\collect
static.py", line 163, in handle_noargs
collected = self.collect()
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\contrib\staticfiles\management\commands\collect
static.py", line 120, in collect
for original_path, processed_path, processed in processor:
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\contrib\staticfiles\storage.py",
line 192, in p
ost_process
self.cache.delete_many([self.cache_key(path) for path in paths])
File "C:\Python26\lib\site-
packages\django_versions\Django-1.4c1\django\core\cache\backends\memcached.py",
line 123, in delete_many
self._cache.delete_multi(map(l, keys))
File "build\bdist.win32\egg\memcache.py", line 336, in delete_multi
server_keys, prefixed_to_orig_key = self._map_and_prefix_keys(keys,
key_prefix)
File "build\bdist.win32\egg\memcache.py", line 585, in
_map_and_prefix_keys
self.check_key(str_orig_key, key_extra_len=key_extra_len)
File "build\bdist.win32\egg\memcache.py", line 958, in check_key
"Control characters not allowed")
MemcachedKeyCharacterError: Control characters not allowed
}}}
After a bit of digging, the root cause is a file which filename contains
spaces,
e.g. in my case there is a file:
django/contrib/admin/static/admin/filebrowser/uploadify/Uploadify v2.1.0
Manual.pdf
The above test case is failing while trying to use the following cache
key:
u'staticfiles:cache:admin\\filebrowser\\uploadify\\Uploadify v2.1.0
Manual.pdf'
This cache key is invalid under Memcached that I'm running.
Patch attached.
--
Ticket URL: <https://code.djangoproject.com/ticket/17861>
Django <https://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.