[Zope-Checkins] CVS: Zope/lib/python/Products/MIMETools - MIMETag.py:1.11

Kiran Jonnalagadda jace at pobox.com
Thu Dec 25 02:24:48 EST 2003


Update of /cvs-repository/Zope/lib/python/Products/MIMETools
In directory cvs.zope.org:/tmp/cvs-serv7945

Modified Files:
	MIMETag.py 
Log Message:
Added cid and cid_expr fields for the Content-ID header. This is needed for embedding images in a HTML message. The programmer is responsible for the actual value of the Content-ID header; it is not autogenerated.


=== Zope/lib/python/Products/MIMETools/MIMETag.py 1.10 => 1.11 ===
--- Zope/lib/python/Products/MIMETools/MIMETag.py:1.10	Wed Aug 14 18:14:27 2002
+++ Zope/lib/python/Products/MIMETools/MIMETag.py	Thu Dec 25 02:24:47 2003
@@ -40,6 +40,7 @@
                                    , encode=None, encode_expr=None
                                    , name=None, name_expr=None
                                    , filename=None, filename_expr=None
+                                   , cid=None, cid_expr=None
                                    , skip_expr=None
                                    , multipart=None
                                    )
@@ -51,6 +52,7 @@
                                    , encode=None, encode_expr=None
                                    , name=None, name_expr=None
                                    , filename=None, filename_expr=None
+                                   , cid=None, cid_expr=None
                                    , skip_expr=None
                                    )
 
@@ -96,6 +98,13 @@
             elif not has_key('filename'):
                 args['filename']=''
 
+            if has_key('cid_expr'):
+                if has_key('cid'):
+                    raise ParseError, _tm('cid and cid_expr given', 'mime')
+                args['cid_expr']=Eval(args['cid_expr'])
+            elif not has_key('cid'):
+                args['cid']=''
+
             if has_key('skip_expr'):
                 args['skip_expr']=Eval(args['skip_expr'])
 
@@ -138,6 +147,9 @@
             if has_key('filename_expr'): f=a['filename_expr'].eval(md)
             else: f=a['filename']
 
+            if has_key('cid_expr'): cid=a['cid_expr'].eval(md)
+            else: cid=a['cid']
+
             if d:
                 if f:
                     inner.addheader('Content-Disposition', '%s;\n filename="%s"' % (d, f))
@@ -145,6 +157,10 @@
                     inner.addheader('Content-Disposition', d)
 
             inner.addheader('Content-Transfer-Encoding', e)
+
+            if cid:
+                inner.addheader('Content-ID', '<%s>' % cid)
+
             if n:
                 plist = [('name', n)]
             else:




More information about the Zope-Checkins mailing list