mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[py3] Always fed hashlib with bytes.
This commit is contained in:
		
				
					committed by
					
						 Aymeric Augustin
						Aymeric Augustin
					
				
			
			
				
	
			
			
			
						parent
						
							a28e2e7c4d
						
					
				
				
					commit
					40b9f4fb8b
				
			| @@ -6,6 +6,7 @@ to load templates from them in order, caching the result. | ||||
| import hashlib | ||||
| from django.template.base import TemplateDoesNotExist | ||||
| from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin | ||||
| from django.utils.encoding import force_bytes | ||||
|  | ||||
| class Loader(BaseLoader): | ||||
|     is_usable = True | ||||
| @@ -40,7 +41,7 @@ class Loader(BaseLoader): | ||||
|         key = template_name | ||||
|         if template_dirs: | ||||
|             # If template directories were specified, use a hash to differentiate | ||||
|             key = '-'.join([template_name, hashlib.sha1('|'.join(template_dirs)).hexdigest()]) | ||||
|             key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()]) | ||||
|  | ||||
|         if key not in self.template_cache: | ||||
|             template, origin = self.find_template(template_name, template_dirs) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user