From: Evan Broder Date: Tue, 5 Aug 2008 01:46:34 +0000 (-0700) Subject: Add a README.txt file to the pyhesiodfs example X-Git-Tag: 1.0.0~24 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-routefs.git/commitdiff_plain/4e57bef57694459e4d81def1410211bdd1d41dd1 Add a README.txt file to the pyhesiodfs example This shows how to create files (not that it's that hard) --- diff --git a/routefs/examples/pyhesiodfs.py b/routefs/examples/pyhesiodfs.py index 2831a14..6c5f77b 100755 --- a/routefs/examples/pyhesiodfs.py +++ b/routefs/examples/pyhesiodfs.py @@ -13,10 +13,11 @@ class PyHesiodFS(routefs.RouteFS): def make_map(self): m = Mapper() m.connect('', controller='getList') + m.connect('README.txt', controller='getReadme') m.connect(':action', controller='getLocker') return m - def getLocker(self, action): + def getLocker(self, action, **kwargs): if action in self.cache: return routefs.Symlink(self.cache[action]) @@ -28,8 +29,17 @@ class PyHesiodFS(routefs.RouteFS): except (TypeError, KeyError, IndexError): return - def getList(self, action): - return routefs.Directory(self.cache.keys()) + def getList(self, **kwargs): + return routefs.Directory(self.cache.keys() + ['README.txt']) + + def getReadme(self, **kwargs): + return """ +This is the pyHesiodFS FUSE automounter. To access a Hesiod filsys, +just access /mit/name. + +If you're using the Finder, try pressing Cmd+Shift+G and then entering +/mit/name +""" if __name__ == '__main__': routefs.main(PyHesiodFS)