mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Fixed #21674 -- Deprecated the import_by_path() function in favor of import_string().
Thanks Aymeric Augustin for the suggestion and review.
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							fcc21837dc
						
					
				
				
					commit
					5d263dee30
				
			| @@ -1,5 +1,5 @@ | ||||
| from copy import copy | ||||
| from django.utils.module_loading import import_by_path | ||||
| from django.utils.module_loading import import_string | ||||
|  | ||||
| # Cache of actual callables. | ||||
| _standard_context_processors = None | ||||
| @@ -162,7 +162,7 @@ def get_standard_processors(): | ||||
|         collect.extend(_builtin_context_processors) | ||||
|         collect.extend(settings.TEMPLATE_CONTEXT_PROCESSORS) | ||||
|         for path in collect: | ||||
|             func = import_by_path(path) | ||||
|             func = import_string(path) | ||||
|             processors.append(func) | ||||
|         _standard_context_processors = tuple(processors) | ||||
|     return _standard_context_processors | ||||
|   | ||||
| @@ -28,7 +28,7 @@ | ||||
| from django.core.exceptions import ImproperlyConfigured | ||||
| from django.template.base import Origin, Template, Context, TemplateDoesNotExist | ||||
| from django.conf import settings | ||||
| from django.utils.module_loading import import_by_path | ||||
| from django.utils.module_loading import import_string | ||||
| from django.utils import six | ||||
|  | ||||
| template_source_loaders = None | ||||
| @@ -95,7 +95,7 @@ def find_template_loader(loader): | ||||
|     else: | ||||
|         args = [] | ||||
|     if isinstance(loader, six.string_types): | ||||
|         TemplateLoader = import_by_path(loader) | ||||
|         TemplateLoader = import_string(loader) | ||||
|  | ||||
|         if hasattr(TemplateLoader, 'load_template_source'): | ||||
|             func = TemplateLoader(*args) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user