kcc topology generator written as python
Michael Wood
esiotrot at gmail.com
Wed Nov 2 01:39:04 MDT 2011
On 2 November 2011 07:23, Andrew Tridgell <tridge at samba.org> wrote:
> Hi Dave,
>
>> As per your suggestions I have rewritten the major portion of the
>> KCC in python. The patchsets are available at:
>>
>> https://github.com/wimberosa/samba/tree/kcc-stable
[...]
> - the method of walking over the keys() in functions like
> load_connection() is unusual. It will work fine, but I think it may
> be clearer to ask for that attribute directly. The pattern we usually
> use is:
>
> if 'options' in msg:
> self.options = int(msg['options'][0])
>
> if you want to make that neater, we could add a helper function a bit
> like getattr() that takes a default value. For example:
>
> self.options = ldb_msg_value(msg, 'options', 0)
It's built-in! :) Well, sort of anyway:
self.options = int(msg.get('options', [0])[0])
--
Michael Wood <esiotrot at gmail.com>
More information about the samba-technical
mailing list