From 478e849a117968a400b9ba585bd7944e229fdf11 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sun, 31 Aug 2008 06:02:19 -0400 Subject: [PATCH] Replace None with a new NoEntry class. Signed-off-by: Anders Kaseorg --- routefs/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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): -- 1.7.9.5