Changeset 140:28d2df4e855f

Show
Ignore:
Timestamp:
23/04/10 13:27:44 (22 months ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

#7: added new script for interactive sessions (interact.py)

Uses IPython if available.
Removed --interact from livetest.py

Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • NEWS

    r126 r140  
    88[API CHANGE] select_folder now returns a dictionary with the full 
    99SELECT command response instead of just the message count (#24). 
     10 
     11Added interact.py, a script for interactive IMAPClient 
     12sessions. Useful for debugging and exploration. Uses IPython if 
     13installed. 
    1014 
    1115 
  • README

    r85 r140  
    6363The code is well documented. See the docstrings for more usage information. 
    6464 
     65 
     66interact.py 
     67----------- 
     68This script connects an IMAPClient instance using the command line 
     69args given and starts an interactive session. This is useful for 
     70exploring the IMAPClient API and testing things out, avoiding the 
     71steps required to set up an IMAPClient instance. 
     72 
     73The IPython shell is used if it is installed. Otherwise the 
     74code.interact() function from the standard library is used. 
     75 
     76 
    6577livetest.py 
    6678----------- 
  • livetest.py

    r139 r140  
    406406                 default=False, help='These tests are destructive. Use this ' 
    407407                 'option to bypass the confirmation prompt.') 
    408     p.add_option('', '--interact', dest='interact', action='store_true', 
    409                  default=False, 
    410                  help='Instead of running tests, set up the connection & drop into a shell') 
    411408 
    412409    options, args = p.parse_args() 
     
    446443        client = imapclient.IMAPClient(options.host, use_uid=use_uid, ssl=options.ssl) 
    447444        client.login(options.username, options.password) 
    448         if options.interact: 
    449             import code 
    450             code.interact('HAI! IMAPClient instance is "c"', local=dict(c=client)) 
    451             break 
    452         else: 
    453             runtests(client) 
    454             print 'SUCCESS' 
     445        runtests(client) 
     446        print 'SUCCESS' 
    455447 
    456448if __name__ == '__main__':