From b69201455cef6cd4818dca15743d556b55586e60 Mon Sep 17 00:00:00 2001
From: Tim Abbott <tabbott@humbughq.com>
Date: Fri, 2 Nov 2012 17:16:19 -0400
Subject: [PATCH] zephyr_mirror: Parse zsig/body in its own function.
(imported from commit b692fa692d24d79f797852acffa0472d68930c88)
---
bots/zephyr_mirror.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/bots/zephyr_mirror.py b/bots/zephyr_mirror.py
index df93a06d..2f680232 100755
--- a/bots/zephyr_mirror.py
+++ b/bots/zephyr_mirror.py
@@ -210,12 +210,15 @@ def process_loop(log):
# Ask the Humbug server about any new classes to subscribe to
update_subscriptions_from_humbug()
-def process_notice(notice, log):
+def parse_zephyr_body(zephyr_data):
try:
- zsig, body = notice.message.split("\x00", 1)
+ (zsig, body) = zephyr_data.split("\x00", 1)
except ValueError:
- body = notice.message
- zsig = ""
+ (zsig, body) = ("", zephyr_data)
+ return (zsig, body)
+
+def process_notice(notice, log):
+ (zsig, body) = parse_zephyr_body(notice.message)
is_personal = False
is_huddle = False