| 386 | |
| 387 | |
| 388 | class DjangoTemplateFrame(object): |
| 389 | IS_PLUGIN_FRAME = True |
| 390 | |
| 391 | def __init__(self, frame): |
| 392 | original_filename = _get_template_original_file_name_from_frame(frame) |
| 393 | self._back_context = frame.f_locals["context"] |
| 394 | self.f_code = FCode("Django Template", original_filename) |
| 395 | self.f_lineno = _get_template_line(frame) |
| 396 | self.f_back = frame |
| 397 | self.f_globals = {} |
| 398 | self.f_locals = self._collect_context(self._back_context) |
| 399 | self.f_trace = None |
| 400 | |
| 401 | def _collect_context(self, context): |
| 402 | res = {} |
| 403 | try: |
| 404 | for d in context.dicts: |
| 405 | for k, v in d.items(): |
| 406 | res[k] = v |
| 407 | except AttributeError: |
| 408 | pass |
| 409 | return res |
| 410 | |
| 411 | def _change_variable(self, name, value): |
| 412 | for d in self._back_context.dicts: |
| 413 | for k, v in d.items(): |
| 414 | if k == name: |
| 415 | d[k] = value |
| 416 | |
| 417 | |
| 418 | class DjangoTemplateSyntaxErrorFrame(object): |
no outgoing calls
no test coverage detected