| 
									
										
										
										
											2002-04-10 21:01:31 +00:00
										 |  |  |  | # Copyright (C) 2001,2002 Python Software Foundation | 
					
						
							| 
									
										
										
										
											2001-09-23 03:17:28 +00:00
										 |  |  |  | # Author: barry@zope.com (Barry Warsaw) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | """Base class for MIME specializations.
 | 
					
						
							|  |  |  |  | """
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-06-02 19:05:08 +00:00
										 |  |  |  | from email import Message | 
					
						
							| 
									
										
										
										
											2001-09-23 03:17:28 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-10-04 17:05:11 +00:00
										 |  |  |  |  | 
					
						
							| 
									
										
										
										
											2001-09-23 03:17:28 +00:00
										 |  |  |  | class MIMEBase(Message.Message): | 
					
						
							|  |  |  |  |     """Base class for MIME specializations.""" | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-09-26 05:36:36 +00:00
										 |  |  |  |     def __init__(self, _maintype, _subtype, **_params): | 
					
						
							| 
									
										
										
										
											2001-09-23 03:17:28 +00:00
										 |  |  |  |         """This constructor adds a Content-Type: and a MIME-Version: header.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-09-26 05:36:36 +00:00
										 |  |  |  |         The Content-Type: header is taken from the _maintype and _subtype | 
					
						
							| 
									
										
										
										
											2001-09-23 03:17:28 +00:00
										 |  |  |  |         arguments.  Additional parameters for this header are taken from the | 
					
						
							|  |  |  |  |         keyword arguments. | 
					
						
							|  |  |  |  |         """
 | 
					
						
							|  |  |  |  |         Message.Message.__init__(self) | 
					
						
							| 
									
										
										
										
											2001-09-26 05:36:36 +00:00
										 |  |  |  |         ctype = '%s/%s' % (_maintype, _subtype) | 
					
						
							| 
									
										
										
										
											2001-09-23 03:17:28 +00:00
										 |  |  |  |         self.add_header('Content-Type', ctype, **_params) | 
					
						
							|  |  |  |  |         self['MIME-Version'] = '1.0' |