From de3799589bfd5fc533abadf605515a4d13aa3c5e Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 28 Nov 2012 21:17:07 -0500 Subject: [PATCH] zephyr_mirror: Compare zephyr subs from server after normalization. (imported from commit eea290698e83c7d26f23ab3bb0201914417f0e09) --- api/bots/zephyr_mirror_backend.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/bots/zephyr_mirror_backend.py b/api/bots/zephyr_mirror_backend.py index f844e0323c..1b699d22ba 100755 --- a/api/bots/zephyr_mirror_backend.py +++ b/api/bots/zephyr_mirror_backend.py @@ -34,6 +34,7 @@ import textwrap import signal import logging import hashlib +import unicodedata DEFAULT_SITE = "https://humbughq.com" @@ -158,7 +159,12 @@ def zephyr_bulk_subscribe(subs): # (within 15 seconds). return for (cls, instance, recipient) in subs: - if cls not in actual_zephyr_subs: + # Zephyr class names are canonicalized by first applying NFKC + # normalization and then lower-casing server-side -- so we + # need to compare against those to see if we've successfully + # subscribed. + canonical_cls = unicodedata.normalize("NFKC", cls.decode("utf-8").lower()).encode("utf-8") + if canonical_cls not in actual_zephyr_subs: logging.error("Zephyr failed to subscribe us to %s; will retry" % (cls,)) try: # We'll retry automatically when we next check for