Should be eminently doable with generators.  Just have the filter
processing be a generator "stack" that passes/and `yield up()s" a
standard envelope type--you'd design this envelope and roll your own
mini-filtering-framework depending on what kind of data you need
wrapped.

A close analog in the Python world is WSGI, and the WSGI middleware
concept.  Check out PEP 333 (http://www.python.org/dev/peps/pep-0333/)
for some details about how that particular pluggable/chaining/
filtering system was designed.

 - Jamie

On Jan 3, 6:36 pm, falcon <[email protected]> wrote:
> I like what I see in diesel.  I am not a python programmer, so please
> excuse me if the question has an obvious answer.  I am looking to use
> this framework to implement a text based protocol.  As with most
> protocols, I need to parse incoming data, dispatch it to some handler
> function, maintain sessions, use heartbeats, etc., etc.  Java
> frameworks such as netty, mina and grizzly use a pattern called
> "intercepting filters," (java servlets make light use of them as
> well).  The idea is simple, I break up various parts of my logic into
> different pieces of code, then connect them to each other in a chain.
>
> For example, the "log in/out" filter tests to see if the connection is
> valid, and nothing else.  All subsequent filter never have to worry
> about authentication, if a request gets to them, then the login/out
> filter approved.
>
> As far as I can tell, Python's generators should make such a pattern
> far easier than Java, but I don't see relevant examples in the
> literature (python or diesel).
>
> Any pointers?
>
> Thanks

Reply via email to