summaryrefslogtreecommitdiff
path: root/python/samba/netcmd/encoders.py
AgeCommit message (Collapse)AuthorFilesLines
2024-03-20python: fix json encoder should handle ExceptionRob van der Linde1-1/+1
This happens if --json is used and a CommandError is raised, so will affect other commands too where --json is used. This happens in the print_json_status method. Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-03-01samba-tool domain: add LDB Result to json encodersDouglas Bagnall1-2/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-02-16netcmd: bugfix: json encoder failed to call super methodRob van der Linde1-1/+1
This lead to a strange recursion error when a field came up that the JSONEncoder couldn't encode. Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
2024-02-16netcmd: json encoder supports security descriptor objectsRob van der Linde1-0/+4
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
2023-06-25netcmd: add custom json encoder for object type fieldsRob van der Linde1-0/+49
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>