On Fri, Apr 04, 2008 at 04:39:22PM -0700, [EMAIL PROTECTED] wrote:

> > http://cr.opensolaris.org/~tsk/863.2/
> 
> bootenv.py:
> 
> 34-38 & 313,314 -
> 
> These don't need to be separate steps, do they?  I think it ought to be
> possible to assign BootEnvNull to BootEnv when you handle the
> ImportError exception.  Have you tried this?

It's a pain to do it otherwise, AFAICT.  If you just do the assignment in
the except clause, *that* will fail with a NameError, because BootEnvNull
won't have been defined yet.

And even if you move the definition of BootEnvNull up -- before the import
attempt, or even inside the except clause itself, you'd still need to have
some way to prevent the rest of the file being read, so that the
libbe-based BootEnv class doesn't get defined, overriding the BootEnv name
you'd just set to point to BootEnvNull.

If there's a way to do that, though, then yes, you could get away without
having to call locals().

> 68-70 -
> 
> Do you still need to handle this exception?  I was under the impression
> that since you'd use the Null BootEnv class, you won't hit this code if
> you fail to import be.

Good catch.  I thought he might be catching an exception from *inside*
be.beList().

Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to