@@ -105,6 +105,8 @@ def _is_mimetypes_broken():
105
105
106
106
SG_TIMEZONE = SgTimezone ()
107
107
108
+ SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION = False
109
+
108
110
NO_SSL_VALIDATION = False
109
111
"""
110
112
Turns off hostname matching validation for SSL certificates
@@ -649,7 +651,11 @@ def __init__(self,
649
651
if self .config .rpc_attempt_interval < 0 :
650
652
raise ValueError ("Value of SHOTGUN_API_RETRY_INTERVAL must be positive, "
651
653
"got '%s'." % self .config .rpc_attempt_interval )
652
-
654
+
655
+ global SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION
656
+ if os .environ .get ("SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION" , "0" ).strip ().lower () == "1" :
657
+ SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION = True
658
+
653
659
self ._connection = None
654
660
655
661
self .__ca_certs = self ._get_certs_file (ca_certs )
@@ -4472,11 +4478,9 @@ def _translate_filters_simple(sg_filter):
4472
4478
4473
4479
# Payload optimization: Do not send a full object
4474
4480
# just send the `type` and `id` when combining related queries
4475
- enable_entity_optimization_value = os .environ .get (
4476
- "SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION" , "0"
4477
- ).strip ()
4481
+ global SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION
4478
4482
if (
4479
- enable_entity_optimization_value == "1"
4483
+ SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION
4480
4484
and condition ["path" ] != "id"
4481
4485
and condition ["relation" ] in ["is" , "is_not" ]
4482
4486
and isinstance (values [0 ], dict )
0 commit comments