def _select_namespaces_query(context, session):
 LOG.debug('context.is_admin=%(is_admin)s; context.owner=%(owner)s', {'is_admin': context.is_admin, 'owner': context.owner})
 query_ns = session.query(models.MetadefNamespace)
 if context.is_admin:
  return query_ns
 else:
  if (context.owner is not None):
   query = query_ns.filter(or_((models.MetadefNamespace.owner == context.owner), (models.MetadefNamespace.visibility == 'public')))
  else:
   query = query_ns.filter((models.MetadefNamespace.visibility == 'public'))
  return query

def _select_namespaces_query ( context , session ) : LOG . debug ( 'context.is_admin=%(is_admin)s; context.owner=%(owner)s' , { 'is_admin' : context . is_admin , 'owner' : context . owner } ) query_ns = session . query ( models . MetadefNamespace ) if context . is_admin : return query_ns else : if ( context . owner is not None ) : query = query_ns . filter ( or_ ( ( models . MetadefNamespace . owner == context . owner ) , ( models . MetadefNamespace . visibility == 'public' ) ) ) else : query = query_ns . filter ( ( models . MetadefNamespace . visibility == 'public' ) ) return query
build the query to get all namespaces based on the context .