Replace decentralized topic truncation with a single check when sending messages.

(imported from commit 291c999147dd59a9c7e1d9de446293755c17e99d)
This commit is contained in:
Jessica McKellar
2013-11-22 12:37:21 -05:00
parent baef4b9b00
commit d0a49e3a80
3 changed files with 6 additions and 31 deletions

View File

@@ -511,8 +511,7 @@ def check_message(sender, client, message_type_name, message_to,
subject = subject_name.strip()
if subject == "":
raise JsonableError("Topic can't be empty")
if len(subject) > MAX_SUBJECT_LENGTH:
raise JsonableError("Topic too long")
subject = truncate_topic(subject)
## FIXME: Commented out temporarily while we figure out what we want
# if not valid_stream_name(subject):
# return json_error("Invalid subject name")
@@ -1483,9 +1482,7 @@ def do_update_message(user_profile, message_id, subject, propagate_mode, content
subject = subject.strip()
if subject == "":
raise JsonableError("Topic can't be empty")
if len(subject) > MAX_SUBJECT_LENGTH:
raise JsonableError("Topic too long")
subject = truncate_topic(subject)
event["orig_subject"] = orig_subject
message.subject = subject
event["subject"] = subject