We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b27a472 commit 05d5774Copy full SHA for 05d5774
django_coverage_plugin/plugin.py
@@ -52,16 +52,19 @@ def check_debug():
52
)
53
54
if django.VERSION >= (1, 9):
55
- # The filename used to be self.source[0].name. In more modern Djangos,
56
- # it's context.template.origin.
+ # Since we are grabbing at internal details, we have to adapt as they
+ # change over versions.
57
def filename_for_frame(frame):
58
try:
59
- return frame.f_locals["context"].template.origin.name
+ return frame.f_locals["self"].origin.name
60
except (KeyError, AttributeError):
61
return None
62
63
def position_for_node(node):
64
- return node.token.position
+ try:
65
+ return node.token.position
66
+ except AttributeError:
67
+ return None
68
69
def position_for_token(token):
70
return token.position
0 commit comments