Opened 18 years ago

Closed 17 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)

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

Download all attachments as: .zip

Change History (5)

comment:1 by Adrian Holovaty, 18 years ago

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

comment:2 by anonymous, 18 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 Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:4 by Chris Beaven, 17 years ago

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