@@ -119,6 +119,7 @@ def thread_creator(func, args, kwargs = {}, *extra_args):
119119BREAK_ON_SYSTEMEXIT_ZERO = False
120120DEBUG_STDLIB = False
121121DJANGO_DEBUG = False
122+ IGNORE_DJANGO_TEMPLATE_WARNINGS = False
122123
123124# Py3k compat - alias unicode to str
124125try :
@@ -2289,6 +2290,7 @@ def attach_process_from_socket(sock, debug_options, report = False, block = Fals
22892290
22902291 BREAK_ON_SYSTEMEXIT_ZERO = 'BreakOnSystemExitZero' in debug_options
22912292 DJANGO_DEBUG = 'DjangoDebugging' in debug_options
2293+ IGNORE_DJANGO_TEMPLATE_WARNINGS = 'IgnoreDjangoTemplateWarnings' in debug_options
22922294
22932295 if '' in PREFIXES :
22942296 # If one or more of the prefixes are empty, we can't reliably distinguish stdlib
@@ -2649,6 +2651,9 @@ def _get_source_django_18_or_lower(frame):
26492651 if hasattr (node , 'source' ):
26502652 return node .source
26512653 else :
2654+ if IGNORE_DJANGO_TEMPLATE_WARNINGS :
2655+ return None
2656+
26522657 if IS_DJANGO18 :
26532658 # The debug setting was changed since Django 1.8
26542659 print ("WARNING: Template path is not available. Set the 'debug' option in the OPTIONS of a DjangoTemplates "
@@ -2675,12 +2680,14 @@ def _get_template_file_name(frame):
26752680 return None
26762681 source = _get_source_django_18_or_lower (frame )
26772682 if source is None :
2678- print ("Source is None\n " )
2683+ if not IGNORE_DJANGO_TEMPLATE_WARNINGS :
2684+ print ("Source is None\n " )
26792685 return None
26802686 fname = source [0 ].name
26812687
26822688 if fname == '<unknown source>' :
2683- print ("Source name is %s\n " + fname )
2689+ if not IGNORE_DJANGO_TEMPLATE_WARNINGS :
2690+ print ("Source name is %s\n " + fname )
26842691 return None
26852692 else :
26862693 abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_file (fname )
0 commit comments