werkzeug.pop_path_info¶
-
werkzeug.
pop_path_info
(environ, charset='utf-8', errors='replace')[source]¶ Removes and returns the next segment of PATH_INFO, pushing it onto SCRIPT_NAME. Returns None if there is nothing left on PATH_INFO.
If the charset is set to None a bytestring is returned.
If there are empty segments (
'/foo//bar
) these are ignored but properly pushed to the SCRIPT_NAME:>>> env = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/a/b'} >>> pop_path_info(env) 'a' >>> env['SCRIPT_NAME'] '/foo/a' >>> pop_path_info(env) 'b' >>> env['SCRIPT_NAME'] '/foo/a/b'
New in version 0.5.
Changed in version 0.9: The path is now decoded and a charset and encoding parameter can be provided.
Parameters: environ – the WSGI environment that is modified.