summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pastepy.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/pastepy.py b/pastepy.py
index 6485c24..cc5514d 100644
--- a/pastepy.py
+++ b/pastepy.py
@@ -23,7 +23,7 @@ class Paste(object):
self.formatter = HtmlFormatter(linenos = 'table', lineanchors = 'line', anchorlinenos = True)
def message(self, msg, title = 'Message'):
- start_response('200 OK', [('Content-Type', 'text/html')])
+ self.start_response('200 OK', [('Content-Type', 'text/html')])
return [str(templates.message(searchList = {
'title': '%s – %s' % (settings.pastebin_name, title),
'header': title,
@@ -39,8 +39,7 @@ class Paste(object):
elif mp['type'].value == 'Paste':
return self.add_paste(mp)
else:
- self.start_response('400 Bad Request', [('Content-Type', 'text/plain')])
- return ['Invalid type "%s".' % mp['type'].value]
+ return self.message('Invalid type "%s".' % mp['type'].value, 'Error')
self.start_response('200 OK', [('Content-Type', 'text/html')])
return [str(templates.paste(searchList = {
'title': settings.pastebin_name,
@@ -170,8 +169,7 @@ class Paste(object):
self.path = path
return getattr(self, module)()
else:
- start_response('404 Not Found', [('Content-Type', 'text/html'), ('Location', '/')])
- return ['<a href="/">/</a>']
+ return self.message('Invalid module requested.', 'Error')
if __name__ == '__main__':
from wsgiref.simple_server import make_server