(self, id, mailhost=None, text=None,
                           REQUEST=None, submit=None)
Add a Mail Template with optional file content.
Add a Mail Template with optional file content.
Add a Mail Template with optional file content .
def addMailTemplate(self, id, mailhost=None, text=None,
                           REQUEST=None, submit=None):
    "Add a Mail Template with optional file content."

    id = str(id)
    if REQUEST is None:
        self._setObject(id, MailTemplate(id, text))
        ob = getattr(self, id)
        if mailhost:
            ob._setPropValue('mailhost',mailhost)
        return ob
    else:
        file = REQUEST.form.get('file')
        headers = getattr(file, 'headers', None)
        if headers is None or not file.filename:
            mt = MailTemplate(id, text)
        else:
            mt = MailTemplate(id, file, headers.get('content_type'))

        self._setObject(id, mt)
        ob = getattr(self, id)
        if mailhost:
            ob._setPropValue('mailhost',mailhost)


        if submit == " Add and Edit ":
            u = ob.absolute_url()
        else:
            u = ob.aq_parent.absolute_url()
        REQUEST.RESPONSE.redirect(u+'/manage_main')
def addMailTemplate ( self , id , mailhost = None , text = None , REQUEST = None , submit = None ) : id = str ( id ) if REQUEST is None : self . _setObject ( id , MailTemplate ( id , text ) ) ob = getattr ( self , id ) if mailhost : ob . _setPropValue ( 'mailhost' , mailhost ) return ob else : file = REQUEST . form . get ( 'file' ) headers = getattr ( file , 'headers' , None ) if headers is None or not file . filename : mt = MailTemplate ( id , text ) else : mt = MailTemplate ( id , file , headers . get ( 'content_type' ) ) self . _setObject ( id , mt ) ob = getattr ( self , id ) if mailhost : ob . _setPropValue ( 'mailhost' , mailhost ) if submit == " Add and Edit " : u = ob . absolute_url ( ) else : u = ob . aq_parent . absolute_url ( ) REQUEST . RESPONSE . redirect ( u + '/manage_main' )