def command(self): import code import readline from mailpile import Mailpile variables = globals() variables['session'] = self.session variables['config'] = self.session.config variables['index'] = self.session.config.index variables['mp'] = Mailpile(session=self.session) self.session.config.stop_workers() self.session.ui.block() code.InteractiveConsole(locals=variables).interact("""\ This is Python inside of Mailpile inside of Python. - The `mp` variable is a Pythonic API to the current pile of mail. - The `session` variable is the current UI session. - The `config` variable contains the current configuration. - Press CTRL+D to return to the normal CLI. """) self.session.ui.unblock() self.session.config.prepare_workers(self.session, daemons=True) return self._success(_('That was fun!'))
def command(self): import code import readline from mailpile import Mailpile variables = globals() variables['session'] = self.session variables['mp'] = Mailpile(session=self.session) return code.InteractiveConsole(locals=variables).interact(""" This is Python inside of Mailpile inside of Python. - The `mp` variable is a Pythonic API to the current pile of mail. - The `session` variable is the current UI session. - Press CTRL+D to return to the normal CLI. """)
# Set up some paths mailpile_root = os.path.join(os.path.dirname(__file__), '..') mailpile_test = os.path.join(mailpile_root, 'testing') mailpile_home = os.path.join(mailpile_test, 'tmp') # Add the root to our import path, import API and standard plugins sys.path.append(mailpile_root) from mailpile.plugins import * from mailpile import Mailpile ##[ Black-box test script ]################################################### try: # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) def say(stuff): mp._session.ui.mark(stuff) mp._session.ui.reset_marks() # Set up initial tags and such mp.setup() # Add the mailboxes, scan them for mailbox in ('tests.mbx', 'Maildir'): mp.add(os.path.join(mailpile_test, mailbox)) mp.rescan() # Save and load the index, just for kicks mp._config.index.save()
from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] ICELANDIC = u'r\xfanar' IS_CHARS = (u'\xe1\xe9\xed\xf3\xfa\xfd\xfe\xe6\xf6\xf0\xc1\xc9\xcd\xd3' u'\xda\xdd\xde\xc6\xd6\xd0') MY_FROM = '*****@*****.**' MY_NAME = 'Mailpile Team' MY_KEYID = '0x7848252F' # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config ui = mp._session.ui if '-v' not in sys.argv: from mailpile.ui import SilentInteraction mp._session.ui = SilentInteraction(config) cfg.plugins.load('demos', process_manifest=True) cfg.plugins.load('hacks', process_manifest=True) cfg.plugins.load('experiments', process_manifest=True) cfg.plugins.load('smtp_server', process_manifest=True) def contents(fn): return open(fn, 'r').read()
from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] ICELANDIC = u'r\xfanar' IS_CHARS = (u'\xe1\xe9\xed\xf3\xfa\xfd\xfe\xe6\xf6\xf0\xc1\xc9\xcd\xd3' u'\xda\xdd\xde\xc6\xd6\xd0') MY_FROM = '*****@*****.**' MY_NAME = 'Mailpile Team' MY_KEYID = '0x7848252F' # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config ui = mp._session.ui if '-v' not in sys.argv: from mailpile.ui import SilentInteraction mp._session.ui = SilentInteraction(config) cfg.plugins.load('demos', process_manifest=True) cfg.plugins.load('hacks', process_manifest=True) cfg.plugins.load('smtp_server', process_manifest=True) def contents(fn): return open(fn, 'r').read()
sys.path.append(mailpile_root) from mailpile.mail_source.mbox import MboxMailSource from mailpile.mail_source.maildir import MaildirMailSource from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] ICELANDIC = u'r\xfanar' MY_FROM = '*****@*****.**' MY_NAME = 'Mailpile Team' MY_KEYID = '0x7848252F' # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config ui = mp._session.ui if '-v' not in sys.argv: from mailpile.ui import SilentInteraction mp._session.ui = SilentInteraction(config) cfg.plugins.load('demos', process_manifest=True) cfg.plugins.load('hacks', process_manifest=True) cfg.plugins.load('smtp_server', process_manifest=True) def contents(fn): return open(fn, 'r').read()
os.environ['GNUPGHOME'] = mailpile_gpgh # Add the root to our import path, import API and demo plugins sys.path.append(mailpile_root) import mailpile.plugins.demos from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] MY_FROM = '*****@*****.**' # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config def contents(fn): return open(fn, 'r').read() def grep(w, fn): return '\n'.join([l for l in open(fn, 'r').readlines() if w in l]) def grepv(w, fn): return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])
mailpile_sent = os.path.join(mailpile_home, 'sent.mbx') # Add the root to our import path, import API and standard plugins sys.path.append(mailpile_root) from mailpile.plugins import * from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] MY_FROM = '*****@*****.**' try: # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) def contents(fn): return open(fn, 'r').read() def grep(w, fn): return '\n'.join([l for l in open(fn, 'r').readlines() if w in l]) def grepv(w, fn): return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l]) def say(stuff): mp._session.ui.mark(stuff) mp._session.ui.reset_marks() # Set up initial tags and such
# Add the root to our import path, import API and standard plugins sys.path.append(mailpile_root) from mailpile.plugins import * import mailpile.plugins.demos from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] MY_FROM = '*****@*****.**' # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = mp._session.config def contents(fn): return open(fn, 'r').read() def grep(w, fn): return '\n'.join([l for l in open(fn, 'r').readlines() if w in l]) def grepv(w, fn): return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l]) def say(stuff): mp._session.ui.mark(stuff) mp._session.ui.reset_marks()
os.environ["GNUPGHOME"] = mailpile_gpgh # Add the root to our import path, import API and demo plugins sys.path.append(mailpile_root) import mailpile.plugins.demos from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u"from:r\xfanar", u"from:bjarni"] MY_FROM = "*****@*****.**" # First, we set up a pristine Mailpile os.system("rm -rf %s" % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config def contents(fn): return open(fn, "r").read() def grep(w, fn): return "\n".join([l for l in open(fn, "r").readlines() if w in l]) def grepv(w, fn): return "\n".join([l for l in open(fn, "r").readlines() if w not in l])
from mailpile.mail_source.local import LocalMailSource from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u"from:r\xfanar", u"from:bjarni"] ICELANDIC = u"r\xfanar" IS_CHARS = u"\xe1\xe9\xed\xf3\xfa\xfd\xfe\xe6\xf6\xf0\xc1\xc9\xcd\xd3" u"\xda\xdd\xde\xc6\xd6\xd0" MY_FROM = "*****@*****.**" MY_NAME = "Mailpile Team" MY_KEYID = "0x7848252F" # First, we set up a pristine Mailpile os.system("rm -rf %s" % mailpile_home) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config ui = mp._session.ui if "-v" not in sys.argv: from mailpile.ui import SilentInteraction mp._session.ui = SilentInteraction(config) cfg.plugins.load("demos", process_manifest=True) cfg.plugins.load("hacks", process_manifest=True) cfg.plugins.load("experiments", process_manifest=True) cfg.plugins.load("smtp_server", process_manifest=True) def contents(fn):
mailpile_test = os.path.join(mailpile_root, 'testing') mailpile_home = os.path.join(mailpile_test, 'tmp') # Add the root to our import path, import API and standard plugins sys.path.append(mailpile_root) from mailpile.plugins import * from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] try: # First, we set up a pristine Mailpile os.system('rm -rf %s' % mailpile_home) mp = Mailpile(workdir=mailpile_home) def say(stuff): mp._session.ui.mark(stuff) mp._session.ui.reset_marks() # Set up initial tags and such mp.setup() # Add the mailboxes, scan them for mailbox in ('tests.mbx', 'Maildir'): mp.add(os.path.join(mailpile_test, mailbox)) mp.rescan() # Save and load the index, just for kicks mp._config.index.save()
from mailpile import Mailpile ##[ Black-box test script ]################################################### FROM_BRE = [u'from:r\xfanar', u'from:bjarni'] ICELANDIC = u'r\xfanar' IS_CHARS = (u'\xe1\xe9\xed\xf3\xfa\xfd\xfe\xe6\xf6\xf0\xc1\xc9\xcd\xd3' u'\xda\xdd\xde\xc6\xd6\xd0') MY_FROM = '*****@*****.**' MY_NAME = 'Mailpile Team' MY_KEYID = '0x7848252F' # First, we set up a pristine Mailpile os.system('rm -rf {0!s}'.format(mailpile_home)) mp = Mailpile(workdir=mailpile_home) cfg = config = mp._session.config ui = mp._session.ui if '-v' not in sys.argv: from mailpile.ui import SilentInteraction mp._session.ui = SilentInteraction(config) cfg.plugins.load('demos', process_manifest=True) cfg.plugins.load('hacks', process_manifest=True) cfg.plugins.load('experiments', process_manifest=True) cfg.plugins.load('smtp_server', process_manifest=True) def contents(fn): return open(fn, 'r').read()