6.1.2.1 Traversal
Keywords: modpython

###
6.1.2.1 Traversal

The Publisher handler locates and imports the module specified in the URI. The module location is determined from the `Request.filename` attribute. Before importing, the file extension, if any, is discarded.

Once module is imported, the remaining part of the URI up to the beginning of any query data (a.k.a. PATH_INFO) is used to find an object within the module. The Publisher handler traverses the path, one element at a time from left to right, mapping the elements to Python object within the module.

The traversal will stop and `HTTP_NOTFOUND` will be returned to the client if:

- Any of the traversed object's names begin with an underscore ("`_`"). Use underscores to protect objects that should not be accessible from the web.

- A module is encountered. Published objects cannot be modules for security reasons.

If an object in the path could not be found, `HTTP_NOT_FOUND` is returned to the client.