It's not a _real_ pyhesiodfs if it's not accessible to everyone else.
[invirt/packages/python-routefs.git] / routefs / examples / pyhesiodfs.py
index 2831a14..92986a2 100755 (executable)
@@ -1,4 +1,4 @@
-#!/sw/bin/python2.5
+#!/usr/bin/python
 
 import hesiod
 import routefs
 
 import hesiod
 import routefs
@@ -7,16 +7,18 @@ from routes import Mapper
 class PyHesiodFS(routefs.RouteFS):
     def __init__(self, *args, **kwargs):
         super(PyHesiodFS, self).__init__(*args, **kwargs)
 class PyHesiodFS(routefs.RouteFS):
     def __init__(self, *args, **kwargs):
         super(PyHesiodFS, self).__init__(*args, **kwargs)
+        self.fuse_args.add("allow_other", True)
         
         self.cache = {}
     
     def make_map(self):
         m = Mapper()
         m.connect('', controller='getList')
         
         self.cache = {}
     
     def make_map(self):
         m = Mapper()
         m.connect('', controller='getList')
+        m.connect('README.txt', controller='getReadme')
         m.connect(':action', controller='getLocker')
         return m
     
         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])
         
         if action in self.cache:
             return routefs.Symlink(self.cache[action])
         
@@ -28,8 +30,17 @@ class PyHesiodFS(routefs.RouteFS):
         except (TypeError, KeyError, IndexError):
             return
     
         except (TypeError, KeyError, IndexError):
             return
     
-    def getList(self, action):
-        return routefs.Directory(self.cache.keys())
+    def getList(self, **kwargs):
+        return 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)
 
 if __name__ == '__main__':
     routefs.main(PyHesiodFS)