def get_host_from_body(fn):
 def wrapped(self, req, id, body, *args, **kwargs):
  if ((len(body) == 1) and ('host' in body)):
   host = body['host']
  else:
   raise exc.HTTPBadRequest
  return fn(self, req, id, host, *args, **kwargs)
 return wrapped

def get_host_from_body ( fn ) : def wrapped ( self , req , id , body , * args , ** kwargs ) : if ( ( len ( body ) == 1 ) and ( 'host' in body ) ) : host = body [ 'host' ] else : raise exc . HTTPBadRequest return fn ( self , req , id , host , * args , ** kwargs ) return wrapped
makes sure that the host exists .