On 12/05/2014 04:03 PM, Michał Górny wrote:
> +                             if len(spl) > 1:
> +                                     group = spl[1]
> +                                     try:
> +                                             try:
> +                                                     # maybe it's a gid?
> +                                                     gid = int(group)
> +                                             except ValueError:
> +                                                     gp = grp.getgrnam(group)
> +                                             else:
> +                                                     pw = grp.getgrgid(gid)

Does this behave the same as other tools (like chown) for strings like "12345" 
? I vaguely recall
someone saying that chown tries a string lookup first, and if that fails then 
it tries an integer
lookup.

> +                                     except KeyError:
> +                                             writemsg("!!! Group '%s' 
> invalid or does not exist\n"
> +                                                             % group, 
> noiselevel=-1)
> +                                             return ()
> +
> +                                     gr = gp.gr_gid
> +                             else:
> +                                     gr = pw.pw_gid
> +
> +                             return (pw.pw_uid, gr, pw.pw_dir)
> +
> +                     # user or user:group
> +                     (uid, gid, home) = get_sync_user_data(repo.sync_user)

If it returns () above, this will raise a ValueError, right?

>>> (x, y, z) = ()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: need more than 0 values to unpack

Otherwise, LGTM.
-- 
Thanks,
Zac

Reply via email to