def check_host(fn):
 def wrapped(self, req, id, service=None, *args, **kwargs):
  listed_hosts = _list_hosts(req, service)
  hosts = [h['host_name'] for h in listed_hosts]
  if (id in hosts):
   return fn(self, req, id, *args, **kwargs)
  else:
   message = (_("Host '%s' could not be found.") % id)
   raise webob.exc.HTTPNotFound(explanation=message)
 return wrapped

def check_host ( fn ) : def wrapped ( self , req , id , service = None , * args , ** kwargs ) : listed_hosts = _list_hosts ( req , service ) hosts = [ h [ 'host_name' ] for h in listed_hosts ] if ( id in hosts ) : return fn ( self , req , id , * args , ** kwargs ) else : message = ( _ ( "Host '%s' could not be found." ) % id ) raise webob . exc . HTTPNotFound ( explanation = message ) return wrapped
makes sure that the host exists .