def wsgify(func):
 argspec = inspect.getargspec(func)
 if (argspec.args and (argspec.args[0] == 'self')):
  @functools.wraps(func)
  def _wsgify_self(self, env, start_response):
   try:
    return func(self, Request(env))(env, start_response)
   except HTTPException as err_resp:
    return err_resp(env, start_response)
  return _wsgify_self
 else:
  @functools.wraps(func)
  def _wsgify_bare(env, start_response):
   try:
    return func(Request(env))(env, start_response)
   except HTTPException as err_resp:
    return err_resp(env, start_response)
  return _wsgify_bare

def wsgify ( func ) : argspec = inspect . getargspec ( func ) if ( argspec . args and ( argspec . args [ 0 ] == 'self' ) ) : @ functools . wraps ( func ) def _wsgify_self ( self , env , start_response ) : try : return func ( self , Request ( env ) ) ( env , start_response ) except HTTPException as err_resp : return err_resp ( env , start_response ) return _wsgify_self else : @ functools . wraps ( func ) def _wsgify_bare ( env , start_response ) : try : return func ( Request ( env ) ) ( env , start_response ) except HTTPException as err_resp : return err_resp ( env , start_response ) return _wsgify_bare
a decorator for translating functions which take a swob request object and return a response object into wsgi callables .