[EMAIL PROTECTED] wrote: >>> Is an instance of EnvironmentError guaranteed to have a filename >>> member (or at least on rmdir)? >>> >>> >> From what I've understood from >> http://www.python.org/doc/2.5.2/lib/module-exceptions.html, >> EnvironmentErrors are guaranteed to have a filename attribute. Whether >> rmdir is guaranteed to always set that attribute isn't specified in the >> documentation I've read. If it's not set, it's value is None. >> > > The filename attribute will only contain a filename if the exception was > created with a 3-item tuple. Since a lot of EnvironmentErrors are > two-item tuples, it may make sense to restructure the text on lines > 97-100 of api_errors.py so that we only print information about the path > if it is not None. > > If we print an error message with None in the place of the path string, > as shown below, the message isn't going to be very clear. > > Could not operate on None because of insufficient permissions. > Please try the command again using pfexec or otherwise increase > your permissions. > > I think it would be sensible to print the generic part of this message > first, and then += the rest of the contents into the error string if > path is not None. > Good point. I've adjusted the str method a bit, though differently than you proposed mainly to allow for better line wrapping. This webrev also incorporates Danek's suggestions and adds that this also fixes bug 713.
Webrev at: http://cr.opensolaris.org/~bpytlik/ips-1469-v4/ Brock > -j > _______________________________________________ > pkg-discuss mailing list > [email protected] > http://mail.opensolaris.org/mailman/listinfo/pkg-discuss > _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
