Stephane Wirtel (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-bug-fix_null_mail_message_and_signature-stw
 into lp:openobject-addons/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-bug-fix_null_mail_message_and_signature-stw/+merge/94112

avoid to crash if the current user has not a signature
avoid to crash if there is no body in the message
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-bug-fix_null_mail_message_and_signature-stw/+merge/94112
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-bug-fix_null_mail_message_and_signature-stw.
=== modified file 'mail/mail_message.py'
--- mail/mail_message.py	2012-01-31 13:36:57 +0000
+++ mail/mail_message.py	2012-02-22 10:07:37 +0000
@@ -157,7 +157,7 @@
                     msg_txt += truncate_text(message.body_text)
             else:
                 msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
-                msg_txt += message.subject
+                msg_txt += (message.subject or '')
             result[message.id] = msg_txt
         return result
 

=== modified file 'mail/wizard/mail_compose_message.py'
--- mail/wizard/mail_compose_message.py	2012-01-31 13:36:57 +0000
+++ mail/wizard/mail_compose_message.py	2012-02-22 10:07:37 +0000
@@ -147,13 +147,13 @@
             # as it is easier to quote than the HTML version.
             # XXX TODO: make it possible to switch to HTML on the fly
             current_user = self.pool.get('res.users').browse(cr, uid, uid, context)
-            body = message_data.body_text or current_user.signature 
+            body = message_data.body_text or current_user.signature  or ''
             if context.get('mail.compose.message.mode') == 'reply':
                 sent_date = _('On %(date)s, ') % {'date': message_data.date} if message_data.date else ''
                 sender = _('%(sender_name)s wrote:') % {'sender_name': tools.ustr(message_data.email_from or _('You'))}
                 quoted_body = '> %s' % tools.ustr(body.replace('\n', "\n> ") or '')
                 body = '\n'.join(["\n", (sent_date + sender), quoted_body])
-                body += "\n" + current_user.signature
+                body += "\n" + (current_user.signature or '')
                 re_prefix = _("Re:")
                 if not (subject.startswith('Re:') or subject.startswith(re_prefix)):
                     subject = "%s %s" % (re_prefix, subject)

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to