I apparently used to have a crappy sense of style. Let's fix that.
[invirt/packages/python-routefs.git] / routefs / dictfs.py
old mode 100755 (executable)
new mode 100644 (file)
index a0d302c..25904b1
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 """
 DictFS allows you to easily create read-only filesystems when the
 file tree is known in advance.
@@ -12,43 +10,45 @@ A dictionary represents a directory, with keys corresponding to
 file names and the values corresponding to the file contents.
 """
 
-import routefs
-from routes import Mapper
+
 import os
 
+from routes import Mapper
+
+import routefs
+
+
 class DictFS(routefs.RouteFS):
+    controllers = ['handler']
+
     @property
     def files(self):
         """
         This property should be overridden in your DictFS descendant
         """
-        return dict(Hello='World',
-                    Directory=dict(a='a', b='b', c=routefs.Symlink('a')))
-    
+        return dict()
+
     def make_map(self):
         m = Mapper()
-        
+
         m.connect('*path', controller='handler')
-        
+
         return m
-    
+
     def handler(self, path, **kwargs):
         if path != '':
             elements = path.split(os.path.sep)
         else:
             elements = []
-        
+
         try:
             tree = self.files
             for elt in elements:
                 tree = tree[elt]
         except KeyError:
             return
-        
+
         if type(tree) is dict:
-            return routefs.Directory(tree.keys())
+            return tree.keys()
         else:
             return tree
-
-if __name__ == '__main__':
-    routefs.main(DictFS)