Skip to content

Commit 51581e9

Browse files
committed
fix #479
1 parent 6038b7e commit 51581e9

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@
286286
"DebugStdLib",
287287
"BreakOnSystemExitZero",
288288
"DjangoDebugging",
289-
"Sudo"
289+
"Sudo",
290+
"IgnoreDjangoTemplateWarnings"
290291
]
291292
},
292293
"default": [

pythonFiles/PythonTools/visualstudio_py_debugger.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def thread_creator(func, args, kwargs = {}, *extra_args):
119119
BREAK_ON_SYSTEMEXIT_ZERO = False
120120
DEBUG_STDLIB = False
121121
DJANGO_DEBUG = False
122+
IGNORE_DJANGO_TEMPLATE_WARNINGS = False
122123

123124
# Py3k compat - alias unicode to str
124125
try:
@@ -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

Comments
 (0)