#NEWLINE# def metadefs_namespace_list( request , filters = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , sort_dir = 'asc' , sort_key = 'namespace' , marker = None , paginate = False ) : #NEWLINE# #INDENT# "Retrieve a listing of Namespaces\n    :param paginate: If true will perform pagination based on settings.\n    :param marker: Specifies the namespace of the last-seen namespace.\n             The typical pattern of limit and marker is to make an\n             initial limited request and then to use the last\n             namespace from the response as the marker parameter\n             in a subsequent limited request. With paginate, limit\n             is automatically set.\n    :param sort_dir: The sort direction ('asc' or 'desc').\n    :param sort_key: The field to sort on (for example, 'created_at'). Default\n             is namespace. The way base namespaces are loaded into glance\n             typically at first deployment is done in a single transaction\n             giving them a potentially unpredictable sort result when using\n             create_at.\n    :param filters: specifies addition fields to filter on such as name.\n    :returns A tuple of three values:\n             1) Current page results\n             2) A boolean of whether or not there are previous page(s).\n             3) A boolean of whether or not there are more page(s).\n    " #NEWLINE# limit = getattr ( settings , 'API_RESULT_LIMIT' , 1000 ) #NEWLINE# page_size = utils . get_page_size ( request ) #NEWLINE# if paginate : #NEWLINE# #INDENT# request_size = ( page_size + 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# request_size = limit #NEWLINE# #UNINDENT# kwargs = { #NEWLINE# #INDENT# 'filters' : filters , #NEWLINE# #UNINDENT# } #NEWLINE# if marker : #NEWLINE# #INDENT# kwargs [ 'marker' ] = marker #NEWLINE# #UNINDENT# kwargs [ 'sort_dir' ] = sort_dir #NEWLINE# kwargs [ 'sort_key' ] = sort_key #NEWLINE# namespaces_iter = glanceclient ( request , '2' ) . metadefs_namespace . list ( page_size = request_size , limit = limit , ** kwargs ) #NEWLINE# has_prev_data = False #NEWLINE# has_more_data = False #NEWLINE# if paginate : #NEWLINE# #INDENT# namespaces = list ( itertools . islice ( namespaces_iter , request_size ) ) #NEWLINE# if ( len ( namespaces ) > page_size ) : #NEWLINE# #INDENT# namespaces . pop ( ( - 1 ) ) #NEWLINE# has_more_data = True #NEWLINE# if ( marker is not None ) : #NEWLINE# #INDENT# has_prev_data = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( sort_dir == 'desc' ) and ( marker is not None ) ) : #NEWLINE# #INDENT# has_more_data = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( marker is not None ) : #NEWLINE# #INDENT# has_prev_data = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# namespaces = list ( namespaces_iter ) #NEWLINE# #UNINDENT# namespaces = [ Namespace ( namespace ) for namespace in namespaces ] #NEWLINE# return ( namespaces , has_prev_data , has_prev_data )