From: Anders Kaseorg Date: Sun, 31 Aug 2008 10:02:19 +0000 (-0400) Subject: Replace None with a new NoEntry class. X-Git-Tag: 1.0.0~6 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-routefs.git/commitdiff_plain/478e849a117968a400b9ba585bd7944e229fdf11?hp=913edd40e5ffdd2a096d8d65ec3bfeb43078b795;ds=sidebyside Replace None with a new NoEntry class. Signed-off-by: Anders Kaseorg --- diff --git a/routefs/__init__.py b/routefs/__init__.py index 875345b..61816b7 100644 --- a/routefs/__init__.py +++ b/routefs/__init__.py @@ -83,7 +83,7 @@ class RouteFS(fuse.Fuse): """ match = self.map.match(path) if match is None: - return + return NoEntry() controller = match.pop('controller') result = getattr(self, controller)(**match) if type(result) is str: @@ -112,7 +112,7 @@ class RouteFS(fuse.Fuse): predetermined based on which it is. """ obj = self._get_file(path) - if obj is None: + if type(obj) is NoEntry: return -errno.ENOENT st = RouteStat() @@ -136,7 +136,7 @@ class RouteFS(fuse.Fuse): of the file """ obj = self._get_file(path) - if obj is None: + if type(obj) is NoEntry: return -errno.ENOENT elif type(obj) in (Directory, Symlink): return -errno.EINVAL @@ -155,7 +155,13 @@ class RouteFS(fuse.Fuse): else: return obj -class TreeEntry(object): +class TreeKey(object): + pass + +class NoEntry(TreeKey): + pass + +class TreeEntry(TreeKey): default_mode = 0444 def __new__(cls, contents, mode=None):