22
22
Decorations are added when the mailing list had a header and/or footer
23
23
defined, and the decoration handler is told to do personalized decorations.
24
We start by writing the site-global header and footer template.
26
>>> mlist = create_list('test@example.com')
27
>>> mlist.msg_header = """\
27
>>> import os, tempfile
28
>>> template_dir = tempfile.mkdtemp()
29
>>> site_dir = os.path.join(template_dir, 'site', 'en')
30
>>> os.makedirs(site_dir)
31
>>> config.push('templates', """
34
... """.format(template_dir))
36
>>> myheader_path = os.path.join(site_dir, 'myheader.txt')
37
>>> with open(myheader_path, 'w') as fp:
28
39
... Delivery address: $user_address
29
40
... Subscribed address: $user_delivered_to
32
>>> mlist.msg_footer = """\
42
>>> myfooter_path = os.path.join(site_dir, 'myfooter.txt')
43
>>> with open(myfooter_path, 'w') as fp:
33
45
... User name: $user_name
34
46
... Password: $user_password
35
47
... Language: $user_language
36
48
... Options: $user_optionsurl
51
Then create a mailing list which will use this header and footer. Because
52
these are site-global templates, we can use a shorted URL.
54
>>> mlist = create_list('test@example.com')
55
>>> mlist.header_uri = 'mailman:///myheader.txt'
56
>>> mlist.footer_uri = 'mailman:///myfooter.txt'
39
58
>>> transaction.commit()