@@ -77,6 +77,10 @@ def __repr__(self):
77
77
return (f"{ self .__class__ .__name__ } (msgid={ self .msgid } , "
78
78
f"msgtype={ self .msgtype } { optional } )" )
79
79
80
+ def __rich_repr__ (self ):
81
+ yield "msgid" , self .msgid
82
+ yield "controls" , self .controls , None
83
+
80
84
81
85
class Result (Response ):
82
86
result : int
@@ -109,6 +113,13 @@ def __repr__(self):
109
113
return (f"{ self .__class__ .__name__ } "
110
114
f"(msgid={ self .msgid } , result={ self .result } { optional } )" )
111
115
116
+ def __rich_repr__ (self ):
117
+ super ().__rich_repr__ ()
118
+ yield "result" , self .result
119
+ yield "matcheddn" , self .matcheddn , ""
120
+ yield "message" , self .message , ""
121
+ yield "referrals" , self .referrals , None
122
+
112
123
113
124
class SearchEntry (Response ):
114
125
msgtype = ldap .RES_SEARCH_ENTRY
@@ -125,6 +136,11 @@ def __new__(cls, msgid, msgtype, controls=None, *,
125
136
126
137
return instance
127
138
139
+ def __rich_repr__ (self ):
140
+ super ().__rich_repr__ ()
141
+ yield "dn" , self .dn
142
+ yield "attrs" , self .attrs
143
+
128
144
129
145
class SearchReference (Response ):
130
146
msgtype = ldap .RES_SEARCH_REFERENCE
@@ -139,6 +155,10 @@ def __new__(cls, msgid, msgtype, controls=None, *,
139
155
140
156
return instance
141
157
158
+ def __rich_repr__ (self ):
159
+ super ().__rich_repr__ ()
160
+ yield "referrals" , self .referrals
161
+
142
162
143
163
class SearchResult (Result ):
144
164
msgtype = ldap .RES_SEARCH_RESULT
@@ -184,12 +204,23 @@ def __repr__(self):
184
204
return (f"{ self .__class__ .__name__ } "
185
205
f"(msgid={ self .msgid } { optional } )" )
186
206
207
+ def __rich_repr__ (self ):
208
+ # No super(), we put our values between msgid and controls
209
+ yield "msgid" , self .msgid
210
+ yield "name" , self .name , None
211
+ yield "value" , self .value , None
212
+ yield "controls" , self .controls , None
213
+
187
214
188
215
class BindResult (Result ):
189
216
msgtype = ldap .RES_BIND
190
217
191
218
servercreds : Optional [bytes ]
192
219
220
+ def __rich_repr__ (self ):
221
+ super ().__rich_repr__ ()
222
+ yield "servercreds" , self .servercreds , None
223
+
193
224
194
225
class ModifyResult (Result ):
195
226
msgtype = ldap .RES_MODIFY
@@ -267,6 +298,13 @@ def __repr__(self):
267
298
return (f"{ self .__class__ .__name__ } "
268
299
f"(msgid={ self .msgid } , result={ self .result } { optional } )" )
269
300
301
+ def __rich_repr__ (self ):
302
+ # No super(), we put our values between msgid and controls
303
+ yield "msgid" , self .msgid
304
+ yield "name" , self .name , None
305
+ yield "value" , self .value , None
306
+ yield "controls" , self .controls , None
307
+
270
308
271
309
class UnsolicitedNotification (ExtendedResult ):
272
310
msgid = ldap .RES_UNSOLICITED
0 commit comments