[ZCM] [ZC] 213/ 1 Request "Obscure error in OFS/Application.py"

Collector: Zope Bugs and Patches ... zope-coders@zope.org
Mon, 11 Feb 2002 10:43:01 -0500


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

==============================================================
= 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.


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