[issue12191] Add shutil.chown to allow to use user and group name (and not only uid/gid)

STINNER Victor report at bugs.python.org
Mon Jun 20 00:57:15 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

shutil_chown-default-v3.patch:
 - os.chown() is only available on Unix, shutil.chown() should not be defined if os.chown() doesn't exist (require to add a @unittest.skipUnless decorator to the test)
 - tests: is it possible that shutil.chown() exists whereas pwd or grp module is missing? if yes, you should split the test into two parts. it looks like pwd and grp are avaiable on Unix.
 - os.chown(path, -1, -1) is accepted, why not accepting shutil.chown(path) (shutil.chown(path, None, None))?
 - style: i don't like _user name, i suggest uid and gid (or user_id and group_id) instead of _user and _group... or you can reuse user/group variables
 - style: "else: \n if not isinstance(user, int):" can be written "elif not isinstance(user, int):" to avoid an useless level of indentation
 - tests: you may only call os.getuid() and os.getgid() once

----------
nosy: +haypo

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


More information about the Python-bugs-list mailing list