[Twisted-Python] Hacking imap

Anders Hammarquist iko at cd.chalmers.se
Wed Jun 25 17:16:04 EDT 2003

In a message of Tue, 24 Jun 2003 16:30:38 EDT, Jp Calderone writes:
>> So instead of naming the handler functions <state>_<COMMAND>, I'll have
>> <state>_<COMMAND> be a tuple containing ( <handler_function>,
>> <arg_parser>, <arg_parser>, ...) and then call the handler_function
>> with the results of the arg_parser functions.
>  This sounds like a great approach.  If I could make a request (and maybe
>you were going to do this anway), it would be nice if the arg_parsers could
>work incrementally: this is mostly of use when receiving an actual message,

That was the idea. Each arg_parser gets (what's left of) the current line,
and if they need more data, they'll have to arrange for reading it.
(Otherwise the easy fix would have been to have lineReceived() read
literals as well. I tried this approach first, but I didn't like it.)

>  Maybe this means <arg_parser> should be a factory that returns a parser,
>so that state can be more easily managed when parsing the full
>list-expression returned with from a fetch command.

That's a thought. I'll keep it in mind.


 -- Of course I'm crazy, but that doesn't mean I'm wrong.
Anders Hammarquist                                  | iko at cd.chalmers.se
Physics student, Chalmers University of Technology, | Hem: +46 31 88 48 50
G|teborg, Sweden.           RADIO: SM6XMM and N2JGL | Mob: +46 707 27 86 87

More information about the Twisted-Python mailing list