(self, container, drop_id, message=None, attachments=None, from_watchdog=False)
the attachments are expected to conform to what the webob library uses for file uploads,
        namely an instance of `cgi.FieldStorage` with the following attributes:
            - a file handle under the key `file`
            - the name of the file under `filename`
the attachments are expected to conform to what the webob library uses for file uploads,
        namely an instance of `cgi.FieldStorage` with the following attributes:
            - a file handle under the key `file`
            - the name of the file under `filename`
the attachments are expected to conform to what the webob library uses for file uploads namely an instance of cgi . FieldStorage with the following attributes : - a file handle under the key file - the name of the file under filename
def __init__(self, container, drop_id, message=None, attachments=None, from_watchdog=False):
        """
        the attachments are expected to conform to what the webob library uses for file uploads,
        namely an instance of `cgi.FieldStorage` with the following attributes:
            - a file handle under the key `file`
            - the name of the file under `filename`
        """
        self.drop_id = drop_id
        self.container = container
        self.paths_created = []
        self.send_attachments = False
        self.fs_path = fs_dropbox_path = join(container.fs_path, drop_id)
        self.fs_attachment_container = join(self.fs_path, 'attach')
        self.fs_cleansed_attachment_container = join(self.fs_path, 'clean')
        self.fs_replies_path = join(self.fs_path, 'replies')
        self.gpg_context = self.container.gpg_context
        self.admins = self.settings['admins']
        self.editors = self.settings['editors']
        self.theme_package = self.settings.get('theme_package', 'briefkasten')
        self.jinja_env = Environment(loader=PackageLoader(self.theme_package, 'templates'))

        if not exists(fs_dropbox_path):
            mkdir(fs_dropbox_path)
            chmod(fs_dropbox_path, 0o770)
            self.paths_created.append(fs_dropbox_path)
            self.status = u'010 created'
            # create an editor token
            self.editor_token = editor_token = generate_drop_id()
            self._write_message(fs_dropbox_path, 'editor_token', editor_token)
            self.from_watchdog = from_watchdog
        else:
            self.editor_token = open(join(self.fs_path, 'editor_token')).readline()

        # set recipients of email depending on watchdog status
        if self.from_watchdog:
            self.editors = [self.settings['watchdog_imap_recipient']]
        else:
            self.editors = self.settings['editors']

        if message is not None:
            # write the message into a file
            self._write_message(fs_dropbox_path, 'message', message)

        # write the attachment into a file
        if attachments is not None:
            for attachment in attachments:
                if attachment is None:
                    continue
                self.add_attachment(attachment)
def __init__ ( self , container , drop_id , message = None , attachments = None , from_watchdog = False ) : self . drop_id = drop_id self . container = container self . paths_created = [ ] self . send_attachments = False self . fs_path = fs_dropbox_path = join ( container . fs_path , drop_id ) self . fs_attachment_container = join ( self . fs_path , 'attach' ) self . fs_cleansed_attachment_container = join ( self . fs_path , 'clean' ) self . fs_replies_path = join ( self . fs_path , 'replies' ) self . gpg_context = self . container . gpg_context self . admins = self . settings [ 'admins' ] self . editors = self . settings [ 'editors' ] self . theme_package = self . settings . get ( 'theme_package' , 'briefkasten' ) self . jinja_env = Environment ( loader = PackageLoader ( self . theme_package , 'templates' ) ) if not exists ( fs_dropbox_path ) : mkdir ( fs_dropbox_path ) chmod ( fs_dropbox_path , 0o770 ) self . paths_created . append ( fs_dropbox_path ) self . status = u'010 created' # create an editor token self . editor_token = editor_token = generate_drop_id ( ) self . _write_message ( fs_dropbox_path , 'editor_token' , editor_token ) self . from_watchdog = from_watchdog else : self . editor_token = open ( join ( self . fs_path , 'editor_token' ) ) . readline ( ) # set recipients of email depending on watchdog status if self . from_watchdog : self . editors = [ self . settings [ 'watchdog_imap_recipient' ] ] else : self . editors = self . settings [ 'editors' ] if message is not None : # write the message into a file self . _write_message ( fs_dropbox_path , 'message' , message ) # write the attachment into a file if attachments is not None : for attachment in attachments : if attachment is None : continue self . add_attachment ( attachment )