mirror of https://github.com/zulip/zulip.git
Change exception.message to str(exception).
The 'message' attribute in Exception has been deprecated. It has been removed in python 3.
This commit is contained in:
parent
993558c680
commit
e6502710b6
|
@ -326,4 +326,4 @@ def process_message(message, rcpt_to=None, pre_checked=False):
|
|||
process_stream_message(to, subject, message, debug_info)
|
||||
except ZulipEmailForwardError as e:
|
||||
# TODO: notify sender of error, retry if appropriate.
|
||||
log_and_report(message, e.message, debug_info)
|
||||
log_and_report(message, str(e), debug_info)
|
||||
|
|
|
@ -41,10 +41,10 @@ def finish_handler(handler_id, event_queue_id, contents, apply_markdown):
|
|||
queue_id=event_queue_id),
|
||||
request, apply_markdown=apply_markdown)
|
||||
except IOError as e:
|
||||
if e.message != 'Stream is closed':
|
||||
if str(e) != 'Stream is closed':
|
||||
logging.exception(err_msg)
|
||||
except AssertionError as e:
|
||||
if e.message != 'Request closed':
|
||||
if str(e) != 'Request closed':
|
||||
logging.exception(err_msg)
|
||||
except Exception:
|
||||
logging.exception(err_msg)
|
||||
|
|
|
@ -7,7 +7,6 @@ from zerver.lib.test_helpers import (
|
|||
AuthedTestCase,
|
||||
most_recent_message,
|
||||
most_recent_usermessage,
|
||||
skip_py3,
|
||||
)
|
||||
|
||||
from zerver.models import (
|
||||
|
@ -67,7 +66,6 @@ class TestStreamEmailMessagesSuccess(AuthedTestCase):
|
|||
self.assertEqual(message.subject, incoming_valid_message['Subject'])
|
||||
|
||||
class TestStreamEmailMessagesEmptyBody(AuthedTestCase):
|
||||
@skip_py3
|
||||
def test_receive_stream_email_messages_empty_body(self):
|
||||
|
||||
# build dummy messages for stream
|
||||
|
@ -101,7 +99,7 @@ class TestStreamEmailMessagesEmptyBody(AuthedTestCase):
|
|||
debug_info)
|
||||
except ZulipEmailForwardError as e:
|
||||
# empty body throws exception
|
||||
exception_message = e.message
|
||||
exception_message = str(e)
|
||||
self.assertEqual(exception_message, "Unable to find plaintext or HTML message body")
|
||||
|
||||
class TestMissedPersonalMessageEmailMessages(AuthedTestCase):
|
||||
|
|
|
@ -22,7 +22,7 @@ def api_airbrake_webhook(request, user_profile, client, payload=REQ(argument_typ
|
|||
subject = get_subject(payload)
|
||||
body = get_body(payload)
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key {} in JSON").format(e.message))
|
||||
return json_error(_("Missing key {} in JSON").format(str(e)))
|
||||
|
||||
check_send_message(user_profile, client, 'stream', [stream], subject, body)
|
||||
return json_success()
|
||||
|
|
|
@ -46,7 +46,7 @@ def api_bitbucket2_webhook(request, user_profile, client, payload=REQ(argument_t
|
|||
type = get_type(request, payload)
|
||||
body = get_body_based_on_type(type)(payload)
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key {} in JSON").format(e.message))
|
||||
return json_error(_("Missing key {} in JSON").format(str(e)))
|
||||
|
||||
check_send_message(user_profile, client, 'stream', [stream], subject, body)
|
||||
return json_success()
|
||||
|
|
|
@ -34,7 +34,7 @@ def api_codeship_webhook(request, user_profile, client, payload=REQ(argument_typ
|
|||
subject = get_subject_for_http_request(payload)
|
||||
body = get_body_for_http_request(payload)
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key {} in JSON").format(e.message))
|
||||
return json_error(_("Missing key {} in JSON").format(str(e)))
|
||||
|
||||
check_send_message(user_profile, client, 'stream', [stream], subject, body)
|
||||
return json_success()
|
||||
|
|
|
@ -34,7 +34,7 @@ def api_crashlytics_webhook(request, user_profile, client, payload=REQ(argument_
|
|||
url=issue_body['url']
|
||||
)
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key {} in JSON".format(e.message)))
|
||||
return json_error(_("Missing key {} in JSON".format(str(e))))
|
||||
|
||||
check_send_message(user_profile, client, 'stream', [stream],
|
||||
subject, body)
|
||||
|
|
|
@ -34,14 +34,14 @@ def api_semaphore_webhook(request, user_profile, client,
|
|||
author_email = payload["commit"]["author_email"]
|
||||
message = payload["commit"]["message"]
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key %s in JSON") % (e.message,))
|
||||
return json_error(_("Missing key %s in JSON") % (str(e),))
|
||||
|
||||
if event == "build":
|
||||
try:
|
||||
build_url = payload["build_url"]
|
||||
build_number = payload["build_number"]
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key %s in JSON") % (e.message,))
|
||||
return json_error(_("Missing key %s in JSON") % (str(e),))
|
||||
content = u"[build %s](%s): %s\n" % (build_number, build_url, result)
|
||||
|
||||
elif event == "deploy":
|
||||
|
@ -52,7 +52,7 @@ def api_semaphore_webhook(request, user_profile, client,
|
|||
deploy_number = payload["number"]
|
||||
server_name = payload["server_name"]
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key %s in JSON") % (e.message,))
|
||||
return json_error(_("Missing key %s in JSON") % (str(e),))
|
||||
content = u"[deploy %s](%s) of [build %s](%s) on server %s: %s\n" % \
|
||||
(deploy_number, deploy_url, build_number, build_url, server_name, result)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def api_stash_webhook(request, user_profile, payload=REQ(argument_type='body'),
|
|||
entry in commit_entries]
|
||||
head_ref = commit_entries[-1]["toCommit"]["displayId"]
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key %s in JSON") % (e.message,))
|
||||
return json_error(_("Missing key %s in JSON") % (str(e),))
|
||||
|
||||
subject = "%s/%s: %s" % (project_name, repo_name, branch_name)
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ def send_message_for_event(event, user_profile, client, stream):
|
|||
subject = SUBJECT_TEMPLATE.format(service_url=event['check']['url'])
|
||||
body = EVENT_TYPE_BODY_MAPPER[event_type](event)
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key {} in JSON").format(e.message))
|
||||
return json_error(_("Missing key {} in JSON").format(str(e)))
|
||||
check_send_message(user_profile, client, 'stream', [stream], subject, body)
|
||||
|
||||
def get_body_for_up_event(event):
|
||||
|
|
Loading…
Reference in New Issue