Commit 8117164d authored by Michel Pelletier's avatar Michel Pelletier

Added support for name attribute to tag

parent 9e5ac014
...@@ -82,8 +82,8 @@ ...@@ -82,8 +82,8 @@
# attributions are listed in the accompanying credits file. # attributions are listed in the accompanying credits file.
# #
############################################################################## ##############################################################################
__rcs_id__='$Id: MIMETag.py,v 1.1 1999/04/02 16:47:24 michel Exp $' __rcs_id__='$Id: MIMETag.py,v 1.2 1999/04/07 20:00:30 michel Exp $'
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
from DocumentTemplate.DT_Util import * from DocumentTemplate.DT_Util import *
from DocumentTemplate.DT_String import String from DocumentTemplate.DT_String import String
...@@ -105,7 +105,8 @@ class MIMETag: ...@@ -105,7 +105,8 @@ class MIMETag:
self.sections = [] self.sections = []
for tname, args, section in blocks: for tname, args, section in blocks:
args = parse_params(args, type=None, disposition=None, encode=None) args = parse_params(args, type=None, disposition=None,
encode=None, name=None)
has_key=args.has_key has_key=args.has_key
...@@ -124,13 +125,19 @@ class MIMETag: ...@@ -124,13 +125,19 @@ class MIMETag:
else: else:
encode = 'base64' encode = 'base64'
if has_key('name'):
name = args['name']
else:
name = ''
if encode not in \ if encode not in \
('base64', 'quoted-printable', 'uuencode', 'x-uuencode', ('base64', 'quoted-printable', 'uuencode', 'x-uuencode',
'uue', 'x-uue', '7bit'): 'uue', 'x-uue', '7bit'):
raise MIMEError, ( raise MIMEError, (
'An unsupported encoding was specified in tag') 'An unsupported encoding was specified in tag')
self.sections.append((type, disposition, encode, section.blocks)) self.sections.append((type, disposition, encode,
name, section.blocks))
def render(self, md): def render(self, md):
...@@ -139,13 +146,20 @@ class MIMETag: ...@@ -139,13 +146,20 @@ class MIMETag:
outer = mw.startmultipartbody('mixed') outer = mw.startmultipartbody('mixed')
for x in self.sections: for x in self.sections:
inner = mw.nextpart() inner = mw.nextpart()
t, d, e, b = x t, d, e, n, b = x
if d: if d:
inner.addheader('Content-Disposition', d) inner.addheader('Content-Disposition', d)
inner.addheader('Content-Transfer-Encoding', e) inner.addheader('Content-Transfer-Encoding', e)
innerfile = inner.startbody(t) print 'hi'
if n:
plist = [('name', n)]
else:
plist = []
innerfile = inner.startbody(t, plist, 1)
output = StringIO() output = StringIO()
if e == '7bit': if e == '7bit':
innerfile.write(render_blocks(b, md)) innerfile.write(render_blocks(b, md))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment