5 from routes import Mapper
7 class PyHesiodFS(routefs.RouteFS):
8 def __init__(self, *args, **kwargs):
9 super(PyHesiodFS, self).__init__(*args, **kwargs)
15 m.connect('', controller='getList')
16 m.connect('README.txt', controller='getReadme')
17 m.connect(':action', controller='getLocker')
20 def getLocker(self, action, **kwargs):
21 if action in self.cache:
22 return routefs.Symlink(self.cache[action])
25 filsys = hesiod.FilsysLookup(action).filsys[0]
26 if filsys['type'] == 'AFS':
27 self.cache[action] = filsys['location']
28 return routefs.Symlink(self.cache[action])
29 except (TypeError, KeyError, IndexError):
32 def getList(self, **kwargs):
33 return routefs.Directory(self.cache.keys() + ['README.txt'])
35 def getReadme(self, **kwargs):
36 return routefs.File("""
37 This is the pyHesiodFS FUSE automounter. To access a Hesiod filsys,
38 just access /mit/name.
40 If you're using the Finder, try pressing Cmd+Shift+G and then entering
44 if __name__ == '__main__':
45 routefs.main(PyHesiodFS)