4 DictFS allows you to easily create read-only filesystems when the
5 file tree is known in advance.
7 To create your own DictFS descendent, simply override the files
8 property, which can be created either using the property
9 decorator, or just a simple assignment.
11 A dictionary represents a directory, with keys corresponding to
12 file names and the values corresponding to the file contents.
16 from routes import Mapper
19 class DictFS(routefs.RouteFS):
23 This property should be overridden in your DictFS descendant
25 return dict(Hello='World',
26 Directory=dict(a='a', b='b', c=routefs.Symlink('a')))
31 m.connect('*path', controller='handler')
35 def handler(self, path, **kwargs):
37 elements = path.split(os.path.sep)
48 if type(tree) is dict:
49 return routefs.Directory(tree.keys())
53 if __name__ == '__main__':