I want to subclass an IMAP connection so that most of the
methods raise an exception if the returned status isn't 'OK'.
This works, but there's got to be a way to do it that doesn't
involve so much duplication:
class MyImap4_ssl(imaplib.IMAP4_SSL):
def login(*args):
s,r = imaplib.IMAP4_SSL.login(*args)
if s!='OK':
raise NotOK((s,r))
return r
def list(*args):
s,r = imaplib.IMAP4_SSL.list(*args)
if s!='OK':
raise NotOK((s,r))
return r
def search(*args):
s,r = imaplib.IMAP4_SSL.search(*args)
if s!='OK':
raise NotOK((s,r))
return r
[and so on for another dozen methods]
--
Grant Edwards grante Yow! I OWN six pink
at HIPPOS!!
visi.com
--
http://mail.python.org/mailman/listinfo/python-list