From abd97578c0096de765cf1d51918211dfd64ba6bb Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 3 Oct 2012 17:53:34 -0400 Subject: [PATCH] Fix zephyr mirror unicode issues, hopefully once and for all. This code successfully sends every message in our corpus of past zephyrs. (imported from commit 14d42ca9288e2a218eaad880691d6bd213a045ce) --- api/common.py | 2 +- zephyr/models.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api/common.py b/api/common.py index 9c59ff845b..36d1377ef3 100644 --- a/api/common.py +++ b/api/common.py @@ -24,7 +24,7 @@ class HumbugAPI(): def send_message(self, submit_hash): submit_hash["email"] = self.email submit_hash["api-key"] = self.api_key - submit_data = urllib.urlencode([(k, v.encode('utf-8')) for k,v in submit_hash.items()]) + submit_data = urllib.urlencode([(k, v) for k,v in submit_hash.items()]) res = self.browser.open(self.base_url + "/api/v1/send_message", submit_data) return simplejson.loads(res.read()) diff --git a/zephyr/models.py b/zephyr/models.py index 976434a3d0..ca13e462fa 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -208,12 +208,8 @@ class Zephyr(models.Model): @cache_with_key(lambda self, apply_markdown: 'zephyr_dict:%d:%d' % (self.id, apply_markdown)) def to_dict(self, apply_markdown): - try: - content = self.content.decode("utf-8") - except: - content = self.content if apply_markdown: - content = md_engine.convert(content) + content = md_engine.convert(self.content) return {'id' : self.id, 'sender_email' : self.sender.user.email, 'sender_name' : self.sender.full_name,