@@ -105,6 +105,8 @@ def _is_mimetypes_broken():
105105
106106SG_TIMEZONE = SgTimezone ()
107107
108+ SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION = False
109+
108110NO_SSL_VALIDATION = False
109111"""
110112Turns off hostname matching validation for SSL certificates
@@ -649,7 +651,11 @@ def __init__(self,
649651 if self .config .rpc_attempt_interval < 0 :
650652 raise ValueError ("Value of SHOTGUN_API_RETRY_INTERVAL must be positive, "
651653 "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+
653659 self ._connection = None
654660
655661 self .__ca_certs = self ._get_certs_file (ca_certs )
@@ -4472,11 +4478,9 @@ def _translate_filters_simple(sg_filter):
44724478
44734479 # Payload optimization: Do not send a full object
44744480 # 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
44784482 if (
4479- enable_entity_optimization_value == "1"
4483+ SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION
44804484 and condition ["path" ] != "id"
44814485 and condition ["relation" ] in ["is" , "is_not" ]
44824486 and isinstance (values [0 ], dict )
0 commit comments