From bd65cf01fb0357cb5476025fa0c56c6b89441dd4 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 15 Jul 2016 09:55:56 -0500 Subject: [PATCH] app: BaseApplication: Remove setup_routes method Originally, I envisioned the `BaseApplication` class calling its `setup_routes` method to set up the request dispatcher, eliminating the need for subclasses to explicitly call it. This is unlikely to work, however, as it will end up being called too early, as there will not yet have been a chance to update the application configuration dictionary. If any controller callables use the application configuration when they are initialized, they will not have correct information. As such, I decided to go ahead and remove this method and let subclasses implement and call it when it makes sense. --- src/milla/app.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/milla/app.py b/src/milla/app.py index e53f9ce..654b2ec 100644 --- a/src/milla/app.py +++ b/src/milla/app.py @@ -63,7 +63,7 @@ class BaseApplication(object): def __init__(self): self.config = self.DEFAULT_CONFIG.copy() - self.setup_routes() + self.dispatcher = None def __call__(self, environ, start_response): start_response = StartResponseWrapper(start_response) @@ -148,15 +148,6 @@ class BaseApplication(object): if filename and os.access(filename, os.R_OK): self.config.update(util.read_config(filename)) - def setup_routes(self): - '''Initialize the request dispatcher - - The default implementation of this method does nothing, but it - is called when an instance of :py:class:`BaseApplication` is - created, and can be used by subclasses to set up the request - dispatcher. - ''' - def make_request(self, environ): '''Create a :py:class:`~milla.Request` from a WSGI environment