Rename MediaGoblin middleware to meddleware to avoid confusion w/ wsgi middleware

hehehehehe, "meddleware"
This commit is contained in:
Christopher Allan Webber 2011-11-25 12:13:56 -06:00
parent 4da6efb459
commit ce5ae8da19
6 changed files with 20 additions and 20 deletions

View File

@ -20,7 +20,7 @@ import urllib
import routes
from webob import Request, exc
from mediagoblin import routing, middleware
from mediagoblin import routing, meddleware
from mediagoblin.tools import common, translate, template
from mediagoblin.tools.response import render_404
from mediagoblin.tools import request as mg_request
@ -100,15 +100,15 @@ class MediaGoblinApp(object):
# matters in always eager mode :)
setup_workbench()
# instantiate application middleware
self.middleware = [common.import_component(m)(self)
for m in middleware.ENABLED_MIDDLEWARE]
# instantiate application meddleware
self.meddleware = [common.import_component(m)(self)
for m in meddleware.ENABLED_MEDDLEWARE]
def __call__(self, environ, start_response):
request = Request(environ)
# pass the request through our middleware classes
for m in self.middleware:
# pass the request through our meddleware classes
for m in self.meddleware:
response = m.process_request(request)
if response is not None:
return response(environ, start_response)
@ -169,8 +169,8 @@ class MediaGoblinApp(object):
# get the response from the controller
response = controller(request)
# pass the response through the middleware
for m in self.middleware[::-1]:
# pass the response through the meddleware
for m in self.meddleware[::-1]:
m.process_response(request, response)
return response(environ, start_response)

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
ENABLED_MIDDLEWARE = (
'mediagoblin.middleware.noop:NoOpMiddleware',
'mediagoblin.middleware.csrf:CsrfMiddleware',
ENABLED_MEDDLEWARE = (
'mediagoblin.meddleware.noop:NoOpMeddleware',
'mediagoblin.meddleware.csrf:CsrfMeddleware',
)

View File

@ -47,8 +47,8 @@ def render_csrf_form_token(request):
return form.csrf_token
class CsrfMiddleware(object):
"""CSRF Protection Middleware
class CsrfMeddleware(object):
"""CSRF Protection Meddleware
Adds a CSRF Cookie to responses and verifies that it is present
and matches the form token for non-safe requests.

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class NoOpMiddleware(object):
class NoOpMeddleware(object):
def __init__(self, mg_app):
self.app = mg_app

View File

@ -50,9 +50,9 @@ $ CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_tests ./bin/nosetests"""
class BadCeleryEnviron(Exception): pass
class TestingMiddleware(object):
class TestingMeddleware(object):
"""
Middleware for the Unit tests
Meddleware for the Unit tests
It might make sense to perform some tests on all
requests/responses. Or prepare them in a special
@ -60,7 +60,7 @@ class TestingMiddleware(object):
for being valid html *after* being rendered.
This module is getting inserted at the front of the
middleware list, which means: requests are handed here
meddleware list, which means: requests are handed here
first, responses last. So this wraps up the "normal"
app.
@ -149,11 +149,11 @@ def get_test_app(dump_old_app=True):
test_app = loadapp(
'config:' + TEST_SERVER_CONFIG)
# Insert the TestingMiddleware, which can do some
# Insert the TestingMeddleware, which can do some
# sanity checks on every request/response.
# Doing it this way is probably not the cleanest way.
# We'll fix it, when we have plugins!
mg_globals.app.middleware.insert(0, TestingMiddleware(mg_globals.app))
mg_globals.app.meddleware.insert(0, TestingMeddleware(mg_globals.app))
app = TestApp(test_app)
MGOBLIN_APP = app

View File

@ -21,7 +21,7 @@ from mediagoblin import mg_globals
from mediagoblin import messages
from mediagoblin.tools import common
from mediagoblin.tools.translate import setup_gettext
from mediagoblin.middleware.csrf import render_csrf_form_token
from mediagoblin.meddleware.csrf import render_csrf_form_token
SETUP_JINJA_ENVS = {}