Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
delete.py47 linesDownload Raw Back to operation
1"""
2"""
3
4# Created on 2013.05.31
5#
6# Author: Giovanni Cannata
7#
8# Copyright 2013 - 2020 Giovanni Cannata
9#
10# This file is part of ldap3.
11#
12# ldap3 is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Lesser General Public License as published
14# by the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# ldap3 is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU Lesser General Public License for more details.
21#
22# You should have received a copy of the GNU Lesser General Public License
23# along with ldap3 in the COPYING and COPYING.LESSER files.
24# If not, see <http://www.gnu.org/licenses/>.
25
26from ..protocol.rfc4511 import DelRequest, LDAPDN, ResultCode
27from ..operation.bind import referrals_to_list
28
29
30def delete_operation(dn):
31    # DelRequest ::= [APPLICATION 10] LDAPDN
32    request = DelRequest(LDAPDN(dn))
33
34    return request
35
36
37def delete_request_to_dict(request):
38    return {'entry': str(request)}
39
40
41def delete_response_to_dict(response):
42    return {'result': int(response['resultCode']),
43            'description': ResultCode().getNamedValues().getName(response['resultCode']),
44            'dn': str(response['matchedDN']),
45            'message': str(response['diagnosticMessage']),
46            'referrals': referrals_to_list(response['referral'])}
47 
codekingpro/portable-devtools · Team Ai