Opened 8 years ago
Last modified 8 years ago
#29306 closed Bug
[bugs]Template variable-lookups system invoke class when access class attribute — at Version 1
| Reported by: | Luoxzhg | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | dev |
| Severity: | Normal | Keywords: | template |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
class A:
def __init__(self, value):
pass
attr="Hello"
from django.template import Template, Context
t = Template(" {{ A.attr }}")
output=t.render(Context({"A": A}))
the output should be "Hello", but it is string_if_invalid, i.e., empty string "" .
Change History (1)
comment:1 by , 8 years ago
| Description: | modified (diff) |
|---|---|
| Summary: | [bugs for all version]Template variable-lookups system evaluate callables before completed the evaluation → [bugs]Template variable-lookups system invoke class when access class attribute |
Note:
See TracTickets
for help on using tickets.