populate_db: Fix crash by removing do_send_message.

This old helper has for years been used only by populate_db, and got
buggy (as of a recent refactoring).  So we just call do_send_messages
directly instead.

Fixes the provisioning error we currently get in Travis CI.
This commit is contained in:
Tim Abbott
2017-01-21 22:07:29 -08:00
parent 0fc2f18c1d
commit c0c9dfb66d
2 changed files with 2 additions and 13 deletions

View File

@@ -752,17 +752,6 @@ def log_message(message):
if not message.sending_client.name.startswith("test:"):
log_event(message.to_log_dict())
# Helper function. Defaults here are overriden by those set in do_send_messages
def do_send_message(message, rendered_content=None, no_log=False, stream=None,
local_id=None, realm=None):
# type: (Union[int, Message], Optional[Text], bool, Optional[Stream], Optional[int], Optional[Realm]) -> int
return do_send_messages([{'message': message,
'rendered_content': rendered_content,
'no_log': no_log,
'stream': stream,
'realm': realm,
'local_id': local_id}])[0]
def render_incoming_message(message, content, message_users, realm):
# type: (Message, Text, Set[UserProfile], Realm) -> Text
realm_alert_words = alert_words_in_realm(realm)

View File

@@ -9,7 +9,7 @@ from zerver.models import Message, UserProfile, Stream, Recipient, UserPresence,
Subscription, get_huddle, Realm, UserMessage, RealmAlias, \
clear_database, get_client, get_user_profile_by_id, \
email_to_username
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_send_message, \
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_send_messages, \
do_change_is_admin
from django.conf import settings
from zerver.lib.bulk_create import bulk_create_realms, \
@@ -391,7 +391,7 @@ def send_messages(data):
saved_data['subject'] = message.subject
message.pub_date = now()
do_send_message(message)
do_send_messages([{'message': message}])
recipients[num_messages] = (message_type, message.recipient.id, saved_data)
num_messages += 1