[Twisted-Python] Flag storing broke in IMAP4Client

John Goerzen jgoerzen at complete.org
Thu Jul 31 21:47:11 EDT 2003


I have discovered what I believe to be a bug in IMAP4Client in the file
imap4.py.  I received the following traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.2/site-packages/twisted/protocols/imap4.py", line 1136, in _defaultHandler
    cmd.finish(rest, self._extraInfo)
  File "/usr/lib/python2.2/site-packages/twisted/protocols/imap4.py", line 146, in finish
    self.defer.callback((send, lastLine))
  File "/usr/lib/python2.2/site-packages/twisted/internet/defer.py", line 218, in callback
  File "/usr/lib/python2.2/site-packages/twisted/internet/defer.py", line 274, in _startRunCallbacks
--- <exception caught here> ---
  File "/usr/lib/python2.2/site-packages/twisted/internet/defer.py", line 288, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
exceptions.TypeError: __cbFetch() got an unexpected keyword argument 'lookFor'

In fact, imap4.py contains:

    def _store(self, messages, cmd, flags, uid):
        store = uid and 'UID STORE' or 'STORE'
        args = ' '.join((messages, cmd, '(%s)' % ' '.join(flags)))
        d = self.sendCommand(Command(store, args, wantResponse=('FETCH',)))
        d.addCallback(self.__cbFetch, lookFor='FLAGS')
        return d

In fact, __cbFetch is defined as:

    def __cbFetch(self, (lines, last)):

No lookfor parameter.

This is with Twisted 1.0.6.

This would likely be a problem for all IMAP commands that issues STORE to the
server: setFlags(), addFlags(), removeFlags(), etc.

-- John

More information about the Twisted-Python mailing list