#83 imap-tte

open-accepted
None
5
2007-05-26
2007-04-26
No

A patch that enables train-to-exhaustion support for IMAP.

This patch has three parts:

1. an __init__.py in the scripts folder that makes some of the classes in sb_imapfilter available to tte.py. This change is not represented in the patch file; you'll have to add __init__.py yourself.

2. Some imap support in mboxutils.py

3. Some refactoring in sb_imapfilter.py to sink the port selection logic into IMAPSession.__init__ so that it can be used by tte.py. In the process we simplify the uses of IMAPSession considerably.

This is probably not refactored in the best way; in particular, #1 above should probably never happen and whatever is used by both sb_imapfilter.py and tte.py should be moved into spambayes/ or at least out of scripts/. However, before taking on any major restructuring I wanted to get this into the hands of a spambayes devel who can make sure I'm on the right track.

Discussion

  • Dave Abrahams

    Dave Abrahams - 2007-04-26
    • assigned_to: nobody --> montanaro
     
  • Dave Abrahams

    Dave Abrahams - 2007-04-26

    Logged In: YES
    user_id=52572
    Originator: YES

    It looks like I forgot one thing in sb_imapfilter.py:

    @@ -1200,6 +1209,7 @@
    imap_filter = IMAPFilter(classifier, message_db)

    httpServer = UserInterfaceServer(options["html_ui", "port"])
    + pwds = [ x[2] for x in servers_data ]
    httpServer.register(IMAPUserInterface(classifier, imaps, pwds,
    IMAPSession, stats=stats,
    close_db=close_db,

    I've attached a complete patch that contains that change and all of my other fixes/workarounds (I have several patches in this tracker that haven't been acted on). You can ignore it if you prefer and just make the additional change above.

    File Added: spambayes.patch

     
  • Dave Abrahams

    Dave Abrahams - 2007-05-09

    Logged In: YES
    user_id=52572
    Originator: YES

    That patch evolved yet again, massively. I implemented a version of culling for IMAP and refactored tte.py to greatly simplify it and remove redundancy. Hope you find that nice and not annoying ;-)
    File Added: sb.patch

     
  • Skip Montanaro

    Skip Montanaro - 2007-05-09

    Logged In: YES
    user_id=44345
    Originator: NO

    Dave,

    Do you think this has stabilized well enough to apply to the
    repository? If so, I'll just make a quick review and apply
    it.

    Skip

     
  • Dave Abrahams

    Dave Abrahams - 2007-05-09

    Logged In: YES
    user_id=52572
    Originator: YES

    I would like you to try it out a little, at least, before feeling confident about it. I've only used it on IMAP folders and I wouldn't want to break the other use cases.

     
  • Dave Abrahams

    Dave Abrahams - 2007-05-10

    comprehensive patch including a previously-missed line and all my other fixes to spambayes

     
  • Dave Abrahams

    Dave Abrahams - 2007-05-10

    Logged In: YES
    user_id=52572
    Originator: YES

    File Added: sb.patch

     
  • Skip Montanaro

    Skip Montanaro - 2007-05-11

    Logged In: YES
    user_id=44345
    Originator: NO

    I applied it to my environment. tte.py and my strange
    fetchmail/sb_bnfilter.py setup seems to work fine.

    contrib/tte.py 1.18
    spambayes/mboxutils.py 1.11
    spambayes/storage.py 1.63
    scripts/sb_imapfilter.py 1.67

     
  • Skip Montanaro

    Skip Montanaro - 2007-05-11
    • status: open --> closed-accepted
     
  • Dave Abrahams

    Dave Abrahams - 2007-05-11

    Logged In: YES
    user_id=52572
    Originator: YES

    Great! Please give the code a once-over before checking it in. It touches quite a few parts of SpamBayes and I don't want to step on any toes.

     
  • Skip Montanaro

    Skip Montanaro - 2007-05-11

    Logged In: YES
    user_id=44345
    Originator: NO

    I'm a little curious about the -C flag. The code reads:

    elif opt in ("-c", "--cullext"):
    cullext = arg
    elif opt in ("-C", "--cullext"):
    cullext = ''
    In general it seems you cleaned up my crappy code in tte.py quite a bit. Thanks for that... A couple comments:

    * The "--cullext" can't work for both -C and -c. Maybe you should have "--cull" (cull with no extension) to avoid conflict? I made that change. Let me know if you have a different change in mind.

    * I don't know the sb_imapfilter code at all. I'll assign this to Tony in case he has a moment to scan that part of the patch. Tony, just mark it closed if you agree with the changes or can easily change anything you take issue with.

    * You're using psycopg classifier? Brave man. ;-)

    Skip

     
  • Skip Montanaro

    Skip Montanaro - 2007-05-11
    • assigned_to: montanaro --> anadelonbrin
    • status: closed-accepted --> pending-accepted
     
  • SourceForge Robot

    • status: pending-accepted --> closed-accepted
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • Dave Abrahams

    Dave Abrahams - 2007-05-26

    new comprehensive patch including a previously-missed line and all my other fixes to spambayes

     
  • Dave Abrahams

    Dave Abrahams - 2007-05-26
    • status: closed-accepted --> open-accepted
     
  • Dave Abrahams

    Dave Abrahams - 2007-05-26

    Logged In: YES
    user_id=52572
    Originator: YES

    On --cullext vs --cull, I was thinking it could be '--cullext=' but if getopt doesn't like that, I'm fine with --cull.

    Since tony isn't very active, the thing got auto-closed. But shouldn't the patch be applied if he's not going to look at it?
    File Added: spambayes.patch

     
  • Skip Montanaro

    Skip Montanaro - 2007-05-26

    Logged In: YES
    user_id=44345
    Originator: NO

    I've already applied the patch. I just assigned it to Tony to remind him to take a peak if he so desires.

    Skip

     

Log in to post a comment.