~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Lib/email/mime/nonmultipart.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2002-2006 Python Software Foundation
 
2
# Author: Barry Warsaw
 
3
# Contact: email-sig@python.org
 
4
 
 
5
"""Base class for MIME type messages that are not multipart."""
 
6
 
 
7
__all__ = ['MIMENonMultipart']
 
8
 
 
9
from email import errors
 
10
from email.mime.base import MIMEBase
 
11
 
 
12
 
 
13
 
 
14
class MIMENonMultipart(MIMEBase):
 
15
    """Base class for MIME multipart/* type messages."""
 
16
 
 
17
    __pychecker__ = 'unusednames=payload'
 
18
 
 
19
    def attach(self, payload):
 
20
        # The public API prohibits attaching multiple subparts to MIMEBase
 
21
        # derived subtypes since none of them are, by definition, of content
 
22
        # type multipart/*
 
23
        raise errors.MultipartConversionError(
 
24
            'Cannot attach additional subparts to non-multipart/*')
 
25
 
 
26
    del __pychecker__