Factory for a load function that delegates to other loaders
depending on the prefix of the requested template path.
The prefix is stripped from the filename when passing on the load
request to the delegate.
>>> load = prefixed(
... app1 = lambda filename: ('app1', filename, None, None),
... app2 = lambda filename: ('app2', filename, None, None)
... )
>>> print(load('app1/foo.html'))
('app1', 'app1/foo.html', None, None)
>>> print(load('app2/bar.html'))
('app2', 'app2/bar.html', None, None)
- Parameters:
delegates - mapping of path prefixes to loader functions
- Returns: function
- the loader function
|