From 46fd2348245f8750dec78589fc5c1cc3610ffc3c Mon Sep 17 00:00:00 2001 From: rht Date: Sat, 7 Oct 2017 16:23:22 +0200 Subject: [PATCH] slack: Clarify var naming of sanitize text function. --- zulip/integrations/slack/slackdata2zulipdata.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zulip/integrations/slack/slackdata2zulipdata.py b/zulip/integrations/slack/slackdata2zulipdata.py index 81be319..e629cd1 100755 --- a/zulip/integrations/slack/slackdata2zulipdata.py +++ b/zulip/integrations/slack/slackdata2zulipdata.py @@ -226,13 +226,14 @@ def channelmessage2zerver_message(slack_dir, channel, added_users, added_channel token = token.replace('<@', ' ') token = token.replace('>', ' ') token = token.replace('|', ' ') - length = len(token.split(' ')) + morphemes = token.split(' ') + length = len(morphemes) if length > 1: - try: - short_name = token.split(' ')[2] - except IndexError: + if length > 2: + short_name = morphemes[2] + else: short_name = '' - token = token.split(' ')[1] + token = morphemes[1] for user in users: if (user['id'] == token and user['name'] == short_name and length == 4) or \ (user['id'] == token and length == 3):