[ZCM] [ZC] 213/ 2 Resolve "Obscure error in OFS/Application.py"

Collector: Zope Bugs, Features, and Patches ... zope-coders@zope.org
Fri, 12 Apr 2002 12:06:20 -0400


Issue #213 Update (Resolve) "Obscure error in OFS/Application.py"
 Status Resolved, Zope/bug low
To followup, visit:
  http://collector.zope.org/Zope/213

==============================================================
= Resolve - Entry #2 by Brian on Apr 12, 2002 12:06 pm

 Status: Pending => Resolved

Thanks - I've fixed this.

-Brian
________________________________________
= Request - Entry #1 by Anonymous User on Feb 11, 2002 10:42 am

In OFS/Application.py line 389, an attribute of the control panel is accessed before the check to see if it is there; which could cause an unhandled exception. It's unlikely to happen, since Zope is shipped with an App object in the skeletal data.fs, but technically it's a mini-bug.

>def initialize(app):
>    # Initialize the application
>
>    # Initialize the cache:
> ****POTENTIALLY COULD CAUSE EXCEPTION ****
> ****SINCE WE ARE NOT SURE THAT C/P EXISTS TILL
> ****AFTER THE hasattr() a few lines down.
>    app.Control_Panel.initialize_cache()
>
>  <snip>
>    # b/c: Ensure that Control Panel exists.
>    if not hasattr(app, 'Control_Panel'):
>  <snip>

To be correct, the line 
>    app.Control_Panel.initialize_cache()

should be after the 'if' clause.


==============================================================