Permalink
Browse files

scrap the error middleware for now

  • Loading branch information...
1 parent 0dfe3ee commit 90e93c8cdd269fcbb5999280de79490b8dac9f42 @rafrombrc rafrombrc committed Apr 27, 2011
Showing with 0 additions and 107 deletions.
  1. +0 −103 linkdrop/controllers/error.py
  2. +0 −4 linkdrop/wsgiapp.py
@@ -1,103 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Raindrop.
-#
-# The Initial Developer of the Original Code is
-# Mozilla Messaging, Inc..
-# Portions created by the Initial Developer are Copyright (C) 2009
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Rob Miller (rmiller@mozilla.com)
-#
-# ***** END LICENSE BLOCK *****
-
-import cgi
-
-from paste.urlparser import PkgResourcesParser
-from webhelpers.html.builder import literal
-from linkdrop.lib.base import BaseController
-
-
-error_document_template = literal("""\
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Server Error %(code)s</title>
-<!-- CSS Imports -->
-<link rel="stylesheet" href="%(prefix)s/error/style/black.css" type="text/css"
- media="screen" />
-
-<!-- Favorite Icons -->
-<link rel="icon" href="%(prefix)s/error/img/favicon.ico" type="image/png" />
-
-<style type="text/css">
- .red {
- color:#FF0000;
- }
- .bold {
- font-weight: bold;
- }
-</style>
-</head>
-
-<body>
- <div id="container">
- %(message)s
- </div>
-</body>
-</html>
-""")
-
-
-class ErrorController(BaseController):
- """Generates error documents as and when they are required.
-
- The ErrorDocuments middleware forwards to ErrorController when error
- related status codes are returned from the application.
-
- This behaviour can be altered by changing the parameters to the
- ErrorDocuments middleware in your config/middleware.py file.
-
- """
- def document(self):
- """Render the error document"""
- request = self._py_object.request
- resp = request.environ.get('pylons.original_response')
- content = (literal(resp.body) or
- cgi.escape(request.GET.get('message', '')))
- page = error_document_template % \
- dict(prefix=request.environ.get('SCRIPT_NAME', ''),
- code=cgi.escape(request.GET.get('code',
- str(resp.status_int))),
- message=content)
- return page
-
- def img(self, id):
- """Serve Pylons' stock images"""
- return self._serve_file('/'.join(['media/img', id]))
-
- def style(self, id):
- """Serve Pylons' stock stylesheets"""
- return self._serve_file('/'.join(['media/style', id]))
-
- def _serve_file(self, path):
- """Call Paste's FileApp (a WSGI application) to serve the file
- at the specified path
- """
- request = self._py_object.request
- request.environ['PATH_INFO'] = '/%s' % path
- return PkgResourcesParser('pylons', 'pylons')(
- request.environ, self.start_response)
View
@@ -28,16 +28,13 @@
from linkdrop.controllers.account import AccountController
from linkdrop.controllers.contacts import ContactsController
from linkdrop.controllers.docs import DocsController
-from linkdrop.controllers.error import ErrorController
from linkdrop.controllers.send import SendController
from linkoauth.util import setup_config
from routes.util import URLGenerator
from services.baseapp import set_app, SyncServerApp
from webob.dec import wsgify
urls = [
- ('GET', '/error/{action}', 'error', 'error_action'),
- ('GET', '/error/{action}/{id}', 'error', 'error_action'),
('GET', '/docs', 'docs', 'index'),
('POST', '/send', 'send', 'send'),
('GET', '/account/get', 'account', 'get'),
@@ -50,7 +47,6 @@
controllers = {'account': AccountController,
'contacts': ContactsController,
'docs': DocsController,
- 'error': ErrorController,
'send': SendController,
}

0 comments on commit 90e93c8

Please sign in to comment.