From ca61e30d8f2b2a794374ab3f424df9d5337e778a Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 26 Feb 2009 14:51:24 -0500 Subject: [PATCH 1/1] Eliminate make_map in favor of a simpler map property. --- routefs/__init__.py | 10 +++++----- routefs/dictfs.py | 3 ++- routefs/examples/homefs.py | 5 +++-- routefs/examples/pyhesiodfs.py | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/routefs/__init__.py b/routefs/__init__.py index a9a9144..8d620e6 100644 --- a/routefs/__init__.py +++ b/routefs/__init__.py @@ -43,13 +43,13 @@ class RouteFS(fuse.Fuse): def __init__(self, *args, **kwargs): super(RouteFS, self).__init__(*args, **kwargs) - self.map = self.make_map() self.map.create_regs(self.controllers) - - def make_map(self): + + @property + def map(self): """ - This method should be overridden by descendents of RouteFS to - define the routing for the filesystem + This property should be overridden by descendents of RouteFS + to define the routing for the filesystem """ m = routes.Mapper() diff --git a/routefs/dictfs.py b/routefs/dictfs.py index 77baf63..9b88485 100644 --- a/routefs/dictfs.py +++ b/routefs/dictfs.py @@ -24,7 +24,8 @@ class DictFS(routefs.RouteFS): """ return dict() - def make_map(self): + @property + def map(self): m = Mapper() m.connect('*path', controller='handler') diff --git a/routefs/examples/homefs.py b/routefs/examples/homefs.py index 1666fdd..1ed6e3d 100755 --- a/routefs/examples/homefs.py +++ b/routefs/examples/homefs.py @@ -17,8 +17,9 @@ class HomeFS(routefs.RouteFS): def __init__(self, *args, **kwargs): super(HomeFS, self).__init__(*args, **kwargs) self.cache = {} - - def make_map(self): + + @property + def map(self): m = Mapper() m.connect('', controller='getList') m.connect(':action', controller='getUser') diff --git a/routefs/examples/pyhesiodfs.py b/routefs/examples/pyhesiodfs.py index 880dbb4..c9c526e 100755 --- a/routefs/examples/pyhesiodfs.py +++ b/routefs/examples/pyhesiodfs.py @@ -12,7 +12,8 @@ class PyHesiodFS(routefs.RouteFS): self.cache = {} - def make_map(self): + @property + def map(self): m = Mapper() m.connect('', controller='getList') m.connect('README.txt', controller='getReadme') -- 1.7.9.5