close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
- Timestamp:
-
Aug 6, 2008, 12:48:07 PM (16 years ago)
- Author:
-
cmlenz
- Comment:
-
Note about refactored filter registration
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v2
|
v3
|
|
13 | 13 | Possible/peripheral goals: |
14 | 14 | |
| 15 | * Utility functions for generating and verifying encrypted passwords. |
15 | 16 | * WSGI middleware for using `Basic` and `Digest` authentication, primarily in the context of the DevelopmentServer |
16 | 17 | |
… |
… |
|
21 | 22 | == Application Mixin Approach == |
22 | 23 | |
23 | | The current branch defines an `AuthMixIn` class that auth-enabled applications are supposed to subclass. It adds a couple of method stubs to the `Application` class, and contributes a [wiki:RequestFilters request filter] (the details of adding the request filter are rather problematic right now, I'm thinking about various ways for having them order semi-automatically by declaring dependencies). |
| 24 | The current branch defines an `AuthMixIn` class that auth-enabled applications are supposed to subclass. It adds a couple of method stubs to the `Application` class, and contributes a [wiki:RequestFilters request filter] that performs authentication. |
24 | 25 | |
| 26 | == Filters Refactoring == |
| 27 | |
| 28 | Due to the way application mix-in classes can contribute filters, ordering request filters explicitly becomes too painful. The branch enhances the way request filters are defined by allowing them to declare the abstract service they provide (such as "localization" or "error-handling"), and also declare what services they rely on to do their job. For example: |
| 29 | |
| 30 | {{{ |
| 31 | #!python |
| 32 | @filters.register('form-processing', requires=['templating', 'localization']) |
| 33 | def form_filter(request, response, chain): |
| 34 | ... |
| 35 | }}} |
| 36 | |
| 37 | The ordering of request filters is then inferred from this dependency information. |