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(':action', controller='getLocker')
19 def getLocker(self, action):
20 if action in self.cache:
21 return routefs.Symlink(self.cache[action])
24 filsys = hesiod.FilsysLookup(action).filsys[0]
25 if filsys['type'] == 'AFS':
26 self.cache[action] = filsys['location']
27 return routefs.Symlink(self.cache[action])
28 except (TypeError, KeyError, IndexError):
31 def getList(self, action):
32 return routefs.Directory(self.cache.keys())
34 if __name__ == '__main__':
35 routefs.main(PyHesiodFS)