[issue12191] Shutil - add chown() in order to allow to use user and group name (and not only uid/gid)

Charles-François Natali report at bugs.python.org
Fri May 27 00:20:06 CEST 2011


Charles-François Natali <neologix at free.fr> added the comment:

I didn't test, but after skimming through the code I think that if an invalid user name/group name is provided, os.chown is passed None, which will fail with ValueError.
It would be better to raise an explicit error like "no such user" / "no such group".
That's something you could add to the tests.

Also, you could initialize _user to -1 instead of None, and replace
    if user is None:
        _user = -1
    else:
        [...]
with
    if user is not None:
        [...]

Same goes for _group.

----------
nosy: +charles-francois.natali

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12191>
_______________________________________


More information about the Python-bugs-list mailing list