This reverts commit
ca61e30d8f2b2a794374ab3f424df9d5337e778a.
As much as I like using the property instead of the function, it's way
more inefficient to generate the map every time it's accessed. Plus,
you need to seed the map with the controller list, which obviously
wouldn't stick.
I'd switch to using a memoization function of some sort or another,
but Python seems to have utterly failed to standardize on one.
def __init__(self, *args, **kwargs):
super(RouteFS, self).__init__(*args, **kwargs)
+ self.map = self.make_map()
self.map.create_regs(self.controllers)
-
- @property
- def map(self):
+
+ def make_map(self):
"""
- This property should be overridden by descendents of RouteFS
- to define the routing for the filesystem
+ This method should be overridden by descendents of RouteFS to
+ define the routing for the filesystem
"""
m = routes.Mapper()
"""
return dict()
- @property
- def map(self):
+ def make_map(self):
m = Mapper()
m.connect('*path', controller='handler')
def __init__(self, *args, **kwargs):
super(HomeFS, self).__init__(*args, **kwargs)
self.cache = {}
-
- @property
- def map(self):
+
+ def make_map(self):
m = Mapper()
m.connect('', controller='getList')
m.connect(':action', controller='getUser')
self.cache = {}
- @property
- def map(self):
+ def make_map(self):
m = Mapper()
m.connect('', controller='getList')
m.connect('README.txt', controller='getReadme')