Opened 19 years ago
Closed 18 years ago
#2082 closed enhancement (worksforme)
[patch] More robust resolve_variable() in Template()
| Reported by: | anonymous | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | dev |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
After having issues with stuff not raising the conventional errors when the templates tries to access them as dictionaries et c; I modified the try/except nest in Template() resolve_variable() to try and make it more robust.
Attachments (1)
Change History (5)
by , 19 years ago
| Attachment: | more_robust_resolve_variable_in_template.diff added |
|---|
comment:1 by , 19 years ago
comment:2 by , 19 years ago
The idea was that the code should check if the object is a dictionary before trying to access it as one, or check if an attribute existed before trying to acccess it. This because I was having problems with certain objects returning errors that were not being handled.
I later realized that stuff like:
"elif bit in dir(current): # attribute lookup"
won't be good anyway since you might want to access attributes via some object's getattr.
comment:3 by , 19 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
comment:4 by , 18 years ago
| Patch needs improvement: | set |
|---|---|
| Resolution: | → worksforme |
| Status: | new → closed |
Anonymous author admitted patch wasn't good enough. Let's just close it for now since there haven't been many complaints about this.
What do you mean by "more robust"? Faster?