Merge pull request #43 from abhishek7/master
Minor updates to blueprints.md, middleware.md, blueprints.py, and request.py
This commit is contained in:
commit
40d8602270
|
@ -3,7 +3,7 @@
|
|||
Blueprints are objects that can be used for sub-routing within an application.
|
||||
Instead of adding routes to the application object, blueprints define similar
|
||||
methods for adding routes, which are then registered with the application in a
|
||||
flexible and plugable manner.
|
||||
flexible and pluggable manner.
|
||||
|
||||
## Why?
|
||||
|
||||
|
@ -82,4 +82,4 @@ with other blueprints or routes registered on the application object.
|
|||
@bp.exception(NotFound)
|
||||
def ignore_404s(request, exception):
|
||||
return text("Yep, I totally found the page: {}".format(request.url))
|
||||
```
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Middleware
|
||||
|
||||
Middleware can be executed before or after requests. It is executed in the order it was registered. If middleware return a response object, the request will stop processing and a response will be returned.
|
||||
Middleware can be executed before or after requests. It is executed in the order it was registered. If middleware returns a response object, the request will stop processing and a response will be returned.
|
||||
|
||||
Middleware is registered via the middleware decorator, and can either be added as 'request' or 'response' middleware, based on the argument provided in the decorator. Response middleware receives both the request and the response as arguments.
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ class Blueprint:
|
|||
def middleware(self, *args, **kwargs):
|
||||
"""
|
||||
"""
|
||||
|
||||
def register_middleware(middleware):
|
||||
self.record(lambda s: s.add_middleware(middleware, *args, **kwargs))
|
||||
return middleware
|
||||
|
|
|
@ -26,6 +26,9 @@ class RequestParameters(dict):
|
|||
|
||||
|
||||
class Request:
|
||||
"""
|
||||
Properties of an HTTP request such as URL, headers, etc.
|
||||
"""
|
||||
__slots__ = (
|
||||
'url', 'headers', 'version', 'method',
|
||||
'query_string', 'body',
|
||||
|
|
Loading…
Reference in New Issue
Block a user