Permalink
Browse files

Bugfix for kumascript cache keys and non-ASCII doc paths

  • Loading branch information...
lmorchard committed May 24, 2012
1 parent ebb73b0 commit fd8d083217562f32be65c598ed41b1f8be110ab5
Showing with 4 additions and 2 deletions.
  1. +4 −2 apps/wiki/views.py
View
@@ -137,7 +137,8 @@ def process(request, document_path=None, *args, **kwargs):
def _document_last_modified(request, document_slug, document_locale):
"""Utility function to derive the last modified timestamp of a document.
Mainly for the @condition decorator."""
- path_hash = (hashlib.md5('%s/%s' % (document_locale, document_slug))
+ path_hash = (hashlib.md5((u'%s/%s' % (document_locale, document_slug))
+ .encode('utf8'))
.hexdigest())
cache_key = DOCUMENT_LAST_MODIFIED_CACHE_KEY_TMPL % path_hash
try:
@@ -320,7 +321,8 @@ def set_common_headers(r):
def _build_kumascript_cache_keys(document_locale, document_slug):
"""Build the cache keys used for Kumascript"""
- path_hash = hashlib.md5('%s/%s' % (document_locale, document_slug))
+ path_hash = hashlib.md5((u'%s/%s' % (document_locale, document_slug))
+ .encode('utf8'))
cache_key = 'kumascript:%s:%s' % (path_hash.hexdigest(), '%s')
ck_etag = cache_key % 'etag'
ck_modified = cache_key % 'modified'

0 comments on commit fd8d083

Please sign in to comment.