def get_container_info(env, app, swift_source=None):
 (version, account, container, unused) = split_path(env['PATH_INFO'], 3, 4, True)
 info = _get_info_from_caches(app, env, account, container)
 if (not info):
  env.setdefault('swift.infocache', {})
  is_autocreate_account = account.startswith(getattr(app, 'auto_create_account_prefix', '.'))
  if (not is_autocreate_account):
   account_info = get_account_info(env, app, swift_source)
   if ((not account_info) or (not is_success(account_info['status']))):
    return headers_to_container_info({}, 0)
  req = _prepare_pre_auth_info_request(env, ('/%s/%s/%s' % (version, account, container)), (swift_source or 'GET_CONTAINER_INFO'))
  resp = req.get_response(app)
  info = _get_info_from_infocache(env, account, container)
  if (info is None):
   info = set_info_cache(app, env, account, container, resp)
 if info:
  info = deepcopy(info)
 else:
  info = headers_to_container_info({}, 0)
 if (('object_count' not in info) and ('container_size' in info)):
  info['object_count'] = info.pop('container_size')
 for field in ('storage_policy', 'bytes', 'object_count'):
  if (info.get(field) is None):
   info[field] = 0
  else:
   info[field] = int(info[field])
 return info

def get_container_info ( env , app , swift_source = None ) : ( version , account , container , unused ) = split_path ( env [ 'PATH_INFO' ] , 3 , 4 , True ) info = _get_info_from_caches ( app , env , account , container ) if ( not info ) : env . setdefault ( 'swift.infocache' , { } ) is_autocreate_account = account . startswith ( getattr ( app , 'auto_create_account_prefix' , '.' ) ) if ( not is_autocreate_account ) : account_info = get_account_info ( env , app , swift_source ) if ( ( not account_info ) or ( not is_success ( account_info [ 'status' ] ) ) ) : return headers_to_container_info ( { } , 0 ) req = _prepare_pre_auth_info_request ( env , ( '/%s/%s/%s' % ( version , account , container ) ) , ( swift_source or 'GET_CONTAINER_INFO' ) ) resp = req . get_response ( app ) info = _get_info_from_infocache ( env , account , container ) if ( info is None ) : info = set_info_cache ( app , env , account , container , resp ) if info : info = deepcopy ( info ) else : info = headers_to_container_info ( { } , 0 ) if ( ( 'object_count' not in info ) and ( 'container_size' in info ) ) : info [ 'object_count' ] = info . pop ( 'container_size' ) for field in ( 'storage_policy' , 'bytes' , 'object_count' ) : if ( info . get ( field ) is None ) : info [ field ] = 0 else : info [ field ] = int ( info [ field ] ) return info
get the info structure for a container .