[rhel7/master/f21 2/2] Add support for custom gid to advanced user setup (#1163803)

Brian C. Lane bcl at redhat.com
Tue Nov 18 21:51:35 UTC 2014


On Tue, Nov 18, 2014 at 04:03:41PM -0500, Anne Mulhern wrote:
> 
> 
> 
> 
> ----- Original Message -----
> > From: "Brian C. Lane" <bcl at redhat.com>
> > To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> > Sent: Tuesday, November 18, 2014 2:43:23 PM
> > Subject: Re: [rhel7/master/f21 2/2] Add support for custom gid to advanced	user	setup (#1163803)
> > 
> > On Mon, Nov 17, 2014 at 08:50:54AM -0500, Anne Mulhern wrote:
> > > > +    m = GROUP_STR_PARSE.match(group_str)
> > > > +    if not m or not GROUPNAME_VALID.match(m.group(1)):
> > > > +        return ("", None)
> > > > +
> > > > +    gid = None
> > > > +    if m.group(3):
> > > > +        gid = int(m.group(3))
> > > > +
> > > > +    return (m.group(1), gid)
> > > 
> > > Might be slightly prettier to do something like:
> > > 
> > > m = GROUP_STR_PARSE.match(group_str)
> > > if not m:
> > >     return ("", None)
> > > 
> > > (group_name, group_id) = m.group(1,3)
> > > 
> > > if not GROUPNAME_VALID.match(group_name):
> > >     return ("", None)
> > > 
> > > return (group_name, group_id and int(group_id))
> > 
> > I like it the way it is, gid should be None when there isn't one, not
> > False.
> > 
> 
> and has convenient (or surprising, depends on your viewpoint) semantics:
> 
> >>> z = None
> >>> z and z.humanReadable()
> >>> 

Oh right, I'd forgotten about that (again). Which means I really don't
want to depend on that behavior.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list