def _get_by_name(context, name, session):
 try:
  query = session.query(models.MetadefNamespace).filter_by(namespace=name)
  namespace_rec = query.one()
 except sa_orm.exc.NoResultFound:
  LOG.debug('Metadata definition namespace=%s was not found.', name)
  raise exc.MetadefNamespaceNotFound(namespace_name=name)
 if (not _is_namespace_visible(context, namespace_rec.to_dict())):
  LOG.debug('Forbidding request, metadata definition namespace=%s is not visible.', name)
  emsg = (_('Forbidding request, metadata definition namespace=%s is not visible.') % name)
  raise exc.MetadefForbidden(emsg)
 return namespace_rec

def _get_by_name ( context , name , session ) : try : query = session . query ( models . MetadefNamespace ) . filter_by ( namespace = name ) namespace_rec = query . one ( ) except sa_orm . exc . NoResultFound : LOG . debug ( 'Metadata definition namespace=%s was not found.' , name ) raise exc . MetadefNamespaceNotFound ( namespace_name = name ) if ( not _is_namespace_visible ( context , namespace_rec . to_dict ( ) ) ) : LOG . debug ( 'Forbidding request, metadata definition namespace=%s is not visible.' , name ) emsg = ( _ ( 'Forbidding request, metadata definition namespace=%s is not visible.' ) % name ) raise exc . MetadefForbidden ( emsg ) return namespace_rec
get a property; raise if ns not found/visible or property not found .