| 37 | |
| 38 | |
| 39 | class _DjangoValidationInfo(ValidationInfo): |
| 40 | @overrides(ValidationInfo._collect_valid_lines_in_template_uncached) |
| 41 | def _collect_valid_lines_in_template_uncached(self, template): |
| 42 | lines = set() |
| 43 | for node in self._iternodes(template.nodelist): |
| 44 | if node.__class__.__name__ in _IGNORE_RENDER_OF_CLASSES: |
| 45 | continue |
| 46 | lineno = self._get_lineno(node) |
| 47 | if lineno is not None: |
| 48 | lines.add(lineno) |
| 49 | return lines |
| 50 | |
| 51 | def _get_lineno(self, node): |
| 52 | if hasattr(node, "token") and hasattr(node.token, "lineno"): |
| 53 | return node.token.lineno |
| 54 | return None |
| 55 | |
| 56 | def _iternodes(self, nodelist): |
| 57 | for node in nodelist: |
| 58 | yield node |
| 59 | |
| 60 | try: |
| 61 | children = node.child_nodelists |
| 62 | except: |
| 63 | pass |
| 64 | else: |
| 65 | for attr in children: |
| 66 | nodelist = getattr(node, attr, None) |
| 67 | if nodelist: |
| 68 | # i.e.: yield from _iternodes(nodelist) |
| 69 | for node in self._iternodes(nodelist): |
| 70 | yield node |
| 71 | |
| 72 | |
| 73 | def add_line_breakpoint( |
no outgoing calls
no test coverage detected