From 4f28fd90241dced95cb4d53cef6b4166e1af22f7 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 1 Mar 2010 20:18:01 +0100 Subject: Make sure paste text is unicode when generating cache. --- pastepy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pastepy.py b/pastepy.py index dae4dd9..9ad21de 100644 --- a/pastepy.py +++ b/pastepy.py @@ -123,7 +123,7 @@ class Paste(object): except: # No cache found, generate it. paste = session.query(db.Paste).filter_by(hash = hash).one() try: - lexername, text = get_formatted(paste.syntax, paste.text) + lexername, text = get_formatted(paste.syntax, paste.text if type(str) == unicode else paste.text.decode('utf8')) except: return self.message('Could not find the lexer "%s".' % paste.syntax, 'Error') cache = db.Cache(hash, lexername, text) -- cgit v1.2.3