markup: first email code

This commit is contained in:
2019-10-19 22:11:21 -07:00
parent c18bedeb81
commit 606f3fd5da
3 changed files with 158 additions and 71 deletions

37
markup/work/test_email.py Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python3
#
# process an .eml file through the whole markup process
import sys
import os
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
parentparentdir = os.path.dirname(parentdir)
sys.path.insert(0, parentparentdir)
import getopt
import django
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'procat2.settings')
django.setup()
from markup.tasks import process_message
def main(argv):
def usage():
print('usage: %s file.eml' % argv[0])
return 100
try:
(opts, args) = getopt.getopt(argv[1:], '')
except getopt.GetoptError:
return usage()
if not args: return usage()
process_message(args[0])
if __name__ == '__main__': sys.exit(main(sys.argv))