summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pastepy.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/pastepy.py b/pastepy.py
index 38c7d1a..1b3f221 100644
--- a/pastepy.py
+++ b/pastepy.py
@@ -97,7 +97,7 @@ class Paste(object):
def preview(self, mp):
try:
- lexername, text = self.get_formatted(mp['syntax'].value.decode('utf8'), mp['text'].value.decode('utf8'))
+ lexername, text = self.get_formatted(mp['syntax'].value.decode('utf-8'), mp['text'].value.decode('utf-8'))
except UnknownSyntaxError:
return self.message('Could not find lexer "%s".' % mp['syntax'].value, 'Error')
@@ -106,18 +106,18 @@ class Paste(object):
'header': '%s – Preview' % settings.pastebin_name,
'hash': None,
'date': datetime.datetime.utcnow().ctime(),
- 'nick': mp['nick'].value.decode('utf8') or 'Anoynmous',
+ 'nick': mp['nick'].value.decode('utf-8') or 'Anoynmous',
'syntax': lexername,
- 'pastetitle': mp['title'].value.decode('utf8') or 'Untitled',
+ 'pastetitle': mp['title'].value.decode('utf-8') or 'Untitled',
'text': text,
'rendered': (lexername or '').startswith('Rendered '),
})
def add_paste(self, mp):
- nick = mp['nick'].value.decode('utf8') or None
- syntax = mp['syntax'].value.decode('utf8') or None
- title = mp['title'].value.decode('utf8') or None
- text = mp['text'].value.decode('utf8').replace('\r', '') or None
+ nick = mp['nick'].value.decode('utf-8') or None
+ syntax = mp['syntax'].value.decode('utf-8') or None
+ title = mp['title'].value.decode('utf-8') or None
+ text = mp['text'].value.decode('utf-8').replace('\r', '') or None
hash = ''.join(random.choice(base62_alphabet) for x in xrange(5))
@@ -169,7 +169,7 @@ class Paste(object):
self.start_response('404 Not Found', [])
return []
try:
- lexername, text = self.get_formatted(paste.syntax, paste.text if type(paste.text) == unicode else paste.text.decode('utf8'))
+ lexername, text = self.get_formatted(paste.syntax, paste.text if type(paste.text) == unicode else paste.text.decode('utf-8'))
except UnknownSyntaxError:
return self.message('Could not find the lexer "%s".' % paste.syntax, 'Error')
cache = db.Cache(hash, lexername, text)
@@ -201,8 +201,8 @@ class Paste(object):
finally:
session.close()
- self.start_response('200 OK', [('Content-Type', 'text/plain; charset=utf-8')])
- return [paste.text.encode('utf8')]
+ self.start_response('200 OK', [('Content-Type', 'text/plain; charset=UTF-8')])
+ return [paste.text.encode('utf-8')]
def highlight_stylesheet(self):
self.start_response('200 OK', [('Content-Type', 'text/css')])
@@ -211,9 +211,9 @@ class Paste(object):
def static(self):
filename = settings.static_root + os.path.sep + self.path[1]
if not self.path[1] in ('paste.css', 'edit.js', 'view.js') or not os.path.exists(filename):
- self.start_response('404 Not Found', [('Content-Type', 'text/html; charset=utf-8'), ('Location', '/')])
+ self.start_response('404 Not Found', [('Content-Type', 'text/html; charset=UTF-8'), ('Location', '/')])
return ['<a href="/">asdf</a>']
- self.start_response('200 OK', [('Content-Type', mimetypes.guess_type(filename)[0] or 'text/plain; charset=utf-8')])
+ self.start_response('200 OK', [('Content-Type', mimetypes.guess_type(filename)[0] or 'text/plain; charset=UTF-8')])
return open(filename, 'rb')
def __call__(self, environ, start_response):