Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #526 (closed defect: fixed)

Opened 13 years ago

Last modified 13 years ago

turbogears.controllers.isinstance() fails to catch exception if 'retrieve_css' exists but isn't a method

Reported by: anonymous Owned by: anonymous
Priority: normal Milestone: 0.9
Component: TurboGears Version:
Severity: normal Keywords:
Cc:

Description

turbogears.controllers.isinstance() calls hasattr(value, "retrieve_css") and then attempts to execute value.retrieve_css() without catching an exception if value.retrieve_css happens to exist but isn't a method.

Same problem on the next line with "retrieve_javascript".

Because of this, CherryPy? is returning a "500 Internal error" when passing a generic object to a template which happens to contain:

def getattr(self, var):

try:

return self.dict[var]

except KeyError?:

return None

Overriding getattr allows me to get around Kid's lack of try...catch handling when returning objects with a variable set of properties.

Change History

comment:1 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed

fixed at [681]

Note: See TracTickets for help on using tickets.