samba-tool group list patch

Michael Wood esiotrot at gmail.com
Tue Feb 19 01:42:04 MST 2013


Hi

On 19 February 2013 06:39, Matthieu Patou <mat at samba.org> wrote:
[...]
> +                hgtype = hex(int("%s" % msg["grouptype"]) &
> 0x00000000FFFFFFFF)
> +                if (hgtype == hex(int(security_group.get("Builtin")))):
> +                    self.outf.write("Security         Builtin\n")
> +                elif (hgtype == hex(int(security_group.get("Domain")))):
> +                    self.outf.write("Security         Domain\n")
[...]
> +                else:
> +                    self.outf.write("\n")
> Can we use a switch ? + precalculated hex
> switch(hgtype):
>     case HEX_SEC_GRP_BUILTIN:
>         ...
>     case HEX_SEC_GRP_DOMAIN:
>         ...

Unfortunately Python doesn't have a switch statement :)

http://www.python.org/dev/peps/pep-3103/

There are alternatives, but they often seem a bit hacky:

http://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python

-- 
Michael Wood <esiotrot at gmail.com>


More information about the samba-technical mailing list