@@ -331,7 +331,11 @@ class _Config(object):
331331 Container for the client configuration.
332332 """
333333
334- def __init__ (self ):
334+ def __init__ (self , sg ):
335+ """
336+ :param sg: Shotgun connection.
337+ """
338+ self ._sg = sg
335339 self .max_rpc_attempts = 3
336340 # From http://docs.python.org/2.6/library/httplib.html:
337341 # If the optional timeout parameter is given, blocking operations
@@ -340,7 +344,7 @@ def __init__(self):
340344 self .timeout_secs = None
341345 self .api_ver = 'api3'
342346 self .convert_datetimes_to_utc = True
343- self .records_per_page = 500
347+ self ._records_per_page = None
344348 self .api_key = None
345349 self .script_name = None
346350 self .user_login = None
@@ -371,6 +375,17 @@ def __init__(self):
371375 self .authorization = None
372376 self .no_ssl_validation = False
373377
378+ @property
379+ def records_per_page (self ):
380+ """
381+ The records per page value from the server.
382+ """
383+ if self ._records_per_page is None :
384+ # Check for api_max_entities_per_page in the server info and change the record per page
385+ # value if it is supplied.
386+ self ._records_per_page = self ._sg .server_info .get ('api_max_entities_per_page' ) or 500
387+ return self ._records_per_page
388+
374389
375390class Shotgun (object ):
376391 """
@@ -519,7 +534,7 @@ def __init__(self,
519534 if connect :
520535 raise ValueError ("must provide login/password, session_token or script_name/api_key" )
521536
522- self .config = _Config ()
537+ self .config = _Config (self )
523538 self .config .api_key = api_key
524539 self .config .script_name = script_name
525540 self .config .user_login = login
@@ -597,9 +612,6 @@ def __init__(self,
597612 if connect :
598613 self .server_caps
599614
600- # Check for api_max_entities_per_page in the server info and change the record per page value if it is supplied.
601- self .config .records_per_page = self .server_info .get ('api_max_entities_per_page' ) or self .config .records_per_page
602-
603615 # When using auth_token in a 2FA scenario we need to switch to session-based
604616 # authentication because the auth token will no longer be valid after a first use.
605617 if self .config .auth_token is not None :
0 commit comments