]> git.ipfire.org Git - thirdparty/samba.git/commit
netcmd: add custom json encoder for object type fields
authorRob van der Linde <rob@catalyst.net.nz>
Tue, 16 May 2023 00:00:56 +0000 (12:00 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 25 Jun 2023 23:29:32 +0000 (23:29 +0000)
commitd01cd64da23bb092c63ef7a2ff57d83c6b4e76e8
tree839f3affe2e902711c0481cb17f0fb71c7d3b12a
parent1a5184e404d602e389b96535e792fc77314f1fd4
netcmd: add custom json encoder for object type fields

The custom JSONEncoder class is also capable of encoding Dn objects to
str, and any object that has a __json__ method.

The __json__ method is not an official dunder method, but this has
been used by other frameworks too (like Pyramid).

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
python/samba/netcmd/encoders.py [new file with mode: 0644]