On 11/09/11 14:47, Danek Duvall wrote:
This changeset fixes a few legacy action bugs which have been plaguing
people for a while:

     https://cr.opensolaris.org/action/browse/pkg/dduvall/legacy

src/modules/actions/legacy.py:

Instead of:

      103 +                pfile = file(pkginfo, "w")
      104 +                for k, v in attrs:
      105 +                        pfile.write("%s=%s\n" % (k, v))
      106 +                pfile.close()

I'd suggest:

with open(pkginfo, "wb") as pfile:
        for k, v in attrs:
                pfile.write("%s=%s\n" % (k, v))

(open() is the preferred way to open files according to pydoc and using with has the added benefit of guaranteeing the file handle is closed even in an exception case.)

Otherwise, LGTM.

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

Reply via email to