def make_grantip(app, global_conf, clobber_username=False, **kw):
 from paste.deploy.converters import asbool
 clobber_username = asbool(clobber_username)
 ip_map = {}
 for (key, value) in kw.items():
  if (':' in value):
   (username, role) = value.split(':', 1)
  else:
   username = value
   role = ''
  if (username == '-'):
   username = ''
  if (role == '-'):
   role = ''
  ip_map[key] = value
 return GrantIPMiddleware(app, ip_map, clobber_username)

def make_grantip ( app , global_conf , clobber_username = False , ** kw ) : from paste . deploy . converters import asbool clobber_username = asbool ( clobber_username ) ip_map = { } for ( key , value ) in kw . items ( ) : if ( ':' in value ) : ( username , role ) = value . split ( ':' , 1 ) else : username = value role = '' if ( username == '-' ) : username = '' if ( role == '-' ) : role = '' ip_map [ key ] = value return GrantIPMiddleware ( app , ip_map , clobber_username )
grant roles or usernames based on ip addresses .