Opened 9 years ago

Closed 7 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:

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)

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

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by anonymous

comment:1 Changed 9 years ago by adrian

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

comment:2 Changed 9 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 8 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 7 years ago by SmileyChris

  • Patch needs improvement set
  • Resolution set to worksforme
  • Status changed from new to 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.

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