Create a new Mapper instance
All keyword arguments are optional.
- controller_scan
- Function reference that will be used to return a list of valid
controllers used during URL matching. If directory keyword arg
is present, it will be passed into the function during its call.
This option defaults to a function that will scan a directory for
controllers.
- directory
- Passed into controller_scan for the directory to scan. It should be
an absolute path if using the default controller_scan function.
- always_scan
- Whether or not the controller_scan function should be run
during every URL match. This is typically a good idea during
development so the server won't need to be restarted anytime a
controller is added.
- register
- Boolean used to determine if the Mapper should use
request_config to register itself as the mapper. Since it's
done on a thread-local basis, this is typically best used during
testing though it won't hurt in other cases.
- explicit
Boolean used to determine if routes should be connected with
implicit defaults of:
{'controller':'content','action':'index','id':None}
When set to True, these defaults will not be added to route
connections and url_for will not use Route memory.
Additional attributes that may be set after mapper initialization (ie,
map.ATTRIBUTE = 'something'):
- encoding
- Used to indicate alternative encoding/decoding systems to use with
both incoming URL's, and during Route generation when passed a
Unicode string. Defaults to 'utf-8'.
- decode_errors
- How to handle errors in the encoding, generally ignoring any chars
that don't convert should be sufficient. Defaults to 'ignore'.
- hardcode_names
- Whether or not Named Routes result in the default options for the
route being used or if they actually force url generation to use
the route. Defaults to False.