def get_mail_body(self, fields, **kwargs): """Returns the mail-body with footer. """ if kwargs.has_key('request'): request = kwargs['request'] else: request = self.REQUEST live_fields = [f for f in fields if not (f.isLabel() or f.isFileField())] bare_fields = [f.fgField for f in live_fields] bodyfield = self.getField('body_pt') # pass both the bare_fields (fgFields only) and full fields. # bare_fields for compatability with older templates, # full fields to enable access to htmlValue body = bodyfield.get(self, fields=bare_fields, wrappedFields=live_fields,**kwargs) if isinstance(body, unicode): body = body.encode(self.getCharset()) keyid = getattr(self, 'gpg_keyid', None) encryption = gpg and keyid if encryption: bodygpg = gpg.encrypt(body, keyid) if bodygpg.strip(): body = bodygpg return body
def get_mail_body(self, fields, **kwargs): """Returns the mail-body with footer. """ if 'request' in kwargs: request = kwargs['request'] else: request = self.REQUEST all_fields = [ f for f in fields if not (f.isLabel() or f.isFileField()) and not (getattr(self, 'showAll', True) and f.getServerSide()) ] # which fields should we show? if getattr(self, 'showAll', True): live_fields = all_fields else: live_fields = \ [f for f in all_fields if f.fgField.getName() in getattr(self, 'showFields', ())] if not getattr(self, 'includeEmpties', True): all_fields = live_fields live_fields = [] for f in all_fields: value = f.htmlValue(request) if value and value != 'No Input': live_fields.append(f) bare_fields = [f.fgField for f in live_fields] bodyfield = self.getField('body_pt') # pass both the bare_fields (fgFields only) and full fields. # bare_fields for compatability with older templates, # full fields to enable access to htmlValue body = bodyfield.get(self, fields=bare_fields, wrappedFields=live_fields, **kwargs) if isinstance(body, unicode): body = body.encode(self.getCharset()) try: keyid = self.getGPGKeyId() except AttributeError: keyid = None encryption = gpg and keyid if encryption: bodygpg = gpg.encrypt(body, keyid) if bodygpg.strip(): body = bodygpg return body
def get_mail_body(self, fields, **kwargs): """Returns the mail-body with footer. """ if 'request' in kwargs: request = kwargs['request'] else: request = self.REQUEST all_fields = [f for f in fields if not (f.isLabel() or f.isFileField()) and not (getattr(self, 'showAll', True) and f.getServerSide())] # which fields should we show? if getattr(self, 'showAll', True): live_fields = all_fields else: live_fields = \ [f for f in all_fields if f.fgField.getName() in getattr(self, 'showFields', ())] if not getattr(self, 'includeEmpties', True): all_fields = live_fields live_fields = [] for f in all_fields: value = f.htmlValue(request) if value and value != 'No Input': live_fields.append(f) bare_fields = [f.fgField for f in live_fields] bodyfield = self.getField('body_pt') # pass both the bare_fields (fgFields only) and full fields. # bare_fields for compatability with older templates, # full fields to enable access to htmlValue body = bodyfield.get(self, fields=bare_fields, wrappedFields=live_fields, **kwargs) if isinstance(body, unicode): body = body.encode(self.getCharset()) try: keyid = self.getGPGKeyId() except AttributeError: keyid = None encryption = gpg and keyid if encryption: bodygpg = gpg.encrypt(body, keyid) if bodygpg.strip(): body = bodygpg return body
def get_mail_body(self, fields, **kwargs): """Returns the mail-body with footer. """ if kwargs.has_key("request"): request = kwargs["request"] else: request = self.REQUEST all_fields = [ f for f in fields if not (f.isLabel() or f.isFileField()) and not (getattr(self, "showAll", True) and f.getServerSide()) ] # which fields should we show? if getattr(self, "showAll", True): live_fields = all_fields else: live_fields = [f for f in all_fields if f.fgField.getName() in getattr(self, "showFields", ())] if not getattr(self, "includeEmpties", True): all_fields = live_fields live_fields = [] for f in all_fields: value = f.htmlValue(request) if value and value != "No Input": live_fields.append(f) bare_fields = [f.fgField for f in live_fields] bodyfield = self.getField("body_pt") # pass both the bare_fields (fgFields only) and full fields. # bare_fields for compatability with older templates, # full fields to enable access to htmlValue body = bodyfield.get(self, fields=bare_fields, wrappedFields=live_fields, **kwargs) if isinstance(body, unicode): body = body.encode(self.getCharset()) keyid = getattr(self, "gpg_keyid", None) encryption = gpg and keyid if encryption: bodygpg = gpg.encrypt(body, keyid) if bodygpg.strip(): body = bodygpg return body