def path_info_pop(environ):
 path = environ.get('PATH_INFO', '')
 if (not path):
  return None
 while path.startswith('/'):
  environ['SCRIPT_NAME'] += '/'
  path = path[1:]
 if ('/' not in path):
  environ['SCRIPT_NAME'] += path
  environ['PATH_INFO'] = ''
  return path
 else:
  (segment, path) = path.split('/', 1)
  environ['PATH_INFO'] = ('/' + path)
  environ['SCRIPT_NAME'] += segment
  return segment

def path_info_pop ( environ ) : path = environ . get ( 'PATH_INFO' , '' ) if ( not path ) : return None while path . startswith ( '/' ) : environ [ 'SCRIPT_NAME' ] += '/' path = path [ 1 : ] if ( '/' not in path ) : environ [ 'SCRIPT_NAME' ] += path environ [ 'PATH_INFO' ] = '' return path else : ( segment , path ) = path . split ( '/' , 1 ) environ [ 'PATH_INFO' ] = ( '/' + path ) environ [ 'SCRIPT_NAME' ] += segment return segment
pops off the next segment of path_info .