Opened 10 years ago

Closed 9 years ago

#2082 closed enhancement (worksforme)

[patch] More robust resolve_variable() in Template()

Reported by: anonymous Owned by: nobody
Component: Template system Version: master
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


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)

more_robust_resolve_variable_in_template.diff (3.8 KB) - added by anonymous 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by anonymous

comment:1 Changed 10 years ago by Adrian Holovaty

What do you mean by "more robust"? Faster?

comment:2 Changed 10 years ago by anonymous

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 Changed 10 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedDesign decision needed

comment:4 Changed 9 years ago by Chris Beaven

Patch needs improvement: set
Resolution: worksforme
Status: newclosed

Anonymous author admitted patch wasn't good enough. Let's just close it for now since there haven't been many complaints about this.

Note: See TracTickets for help on using tickets.
Back to Top