[oe] Event Handlers

Christopher Larson clarson at mvista.com
Thu May 14 22:22:56 UTC 2009


I have a couple comments on our event handlers.  First, the whole  
NotHandled/Handled thing was a terrible idea, I readily admit that.   
Given that bitbake checks whether or not a handler returns Handled,  
and doesn't check for NotHandled, and given that NotHandled is not  
just the common case, it's probably the *only* case, I vote we remove  
all the unnecessary "return NotHandled" as a cleanup.

I'm also going to argue in favor of the removal of the getName() based  
checks in favor of isinstance() based checks.  Imo, the events should  
either be strings, or they should be objects in a class hierarchy, not  
both, which is sort of what it is right now :)

This:
from bb.event import ConfigParsed
if isinstance(e, ConfigParsed):

Seems cleaner than:
from bb.event import getName
if getName(e) == "ConfigParsed":

In my opinion.
-- 
Chris Larson
Software Engineer
MontaVista Software, Inc.
Work: 480-517-5031
Home: 480-963-2636
Email: clarson AT mvista DOT com
Email: clarson AT kergoth DOT com





More information about the Openembedded-devel mailing list