@@ -23,11 +23,11 @@ def patch():
23
23
_xray_register_type_fix
24
24
)
25
25
26
- # wrapt.wrap_function_wrapper(
27
- # 'psycopg2.extras',
28
- # 'register_default_jsonb',
29
- # _xray_register_default_jsonb_fix
30
- # )
26
+ wrapt .wrap_function_wrapper (
27
+ 'psycopg2.extras' ,
28
+ 'register_default_jsonb' ,
29
+ _xray_register_default_jsonb_fix
30
+ )
31
31
32
32
33
33
def _xray_traced_connect (wrapped , instance , args , kwargs ):
@@ -58,12 +58,12 @@ def _xray_register_type_fix(wrapped, instance, args, kwargs):
58
58
return wrapped (* our_args , ** kwargs )
59
59
60
60
61
- # def _xray_register_default_jsonb_fix(wrapped, instance, args, kwargs):
62
- # our_kwargs = dict()
63
- # for key, value in kwargs.items():
64
- # if key == "conn_or_curs" and isinstance(value, (XRayTracedConn, XRayTracedCursor)):
65
- # # unwrap the connection or cursor to be sent to register_default_jsonb
66
- # value = value.__wrapped__
67
- # our_kwargs[key] = value
68
- #
69
- # return wrapped(*args, **our_kwargs)
61
+ def _xray_register_default_jsonb_fix (wrapped , instance , args , kwargs ):
62
+ our_kwargs = dict ()
63
+ for key , value in kwargs .items ():
64
+ if key == "conn_or_curs" and isinstance (value , (XRayTracedConn , XRayTracedCursor )):
65
+ # unwrap the connection or cursor to be sent to register_default_jsonb
66
+ value = value .__wrapped__
67
+ our_kwargs [key ] = value
68
+
69
+ return wrapped (* args , ** our_kwargs )
0 commit comments