def webob_factory(url):
 base_url = url
 def web_request(url, method=None, body=None):
  req = webob.Request.blank(('%s%s' % (base_url, url)))
  if method:
   req.content_type = 'application/json'
   req.method = method
  if body:
   req.body = jsonutils.dumps(body)
  return req
 return web_request

def webob_factory ( url ) : base_url = url def web_request ( url , method = None , body = None ) : req = webob . Request . blank ( ( '%s%s' % ( base_url , url ) ) ) if method : req . content_type = 'application/json' req . method = method if body : req . body = jsonutils . dumps ( body ) return req return web_request
factory for removing duplicate webob code from tests .