mirror of
https://github.com/zulip/zulip.git
synced 2026-07-12 21:04:41 +08:00
Fix unicode issues.
(imported from commit 542dc67a3d2e2d44ef212354b38e4f8212ddef64)
This commit is contained in:
parent
7057091b94
commit
4458c8f3d7
@ -168,7 +168,7 @@ class Zephyr(models.Model):
|
||||
'display_recipient': get_display_recipient(self.recipient),
|
||||
'recipient_id' : self.recipient.id,
|
||||
'instance' : self.instance,
|
||||
'content' : md_engine.convert(self.content),
|
||||
'content' : md_engine.convert(self.content.decode("utf-8")),
|
||||
'timestamp' : calendar.timegm(self.pub_date.timetuple()),
|
||||
'gravatar_hash' : hashlib.md5(self.sender.user.email.lower()).hexdigest(),
|
||||
}
|
||||
|
||||
@ -11,6 +11,12 @@ import time
|
||||
import subprocess
|
||||
import optparse
|
||||
import os
|
||||
import markdown
|
||||
md_engine = markdown.Markdown(
|
||||
extensions = ['fenced_code', 'codehilite'],
|
||||
safe_mode = True,
|
||||
output_format = 'xhtml' )
|
||||
|
||||
zephyr.init()
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
@ -72,12 +78,10 @@ def send_humbug(zeph):
|
||||
|
||||
humbug_data = []
|
||||
for key in zeph.keys():
|
||||
try: val = zeph[key].decode("utf-8").encode("utf-8")
|
||||
except:
|
||||
try:
|
||||
val = zeph[key].encode("utf-8")
|
||||
except:
|
||||
print "wtf!", zeph[key]
|
||||
if isinstance(zeph[key], unicode):
|
||||
val = zeph[key].encode("utf-8")
|
||||
elif isinstance(zeph[key], str):
|
||||
val = zeph[key].decode("utf-8")
|
||||
humbug_data.append((key, val))
|
||||
browser.open("https://app.humbughq.com/forge_zephyr/", urllib.urlencode(humbug_data))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user