Vast improvements to validation, based on suggestions by Rick Copeland.

Error handlers are now internal redirects, rather than browser
redirects.

Added error handler middleware. This needs some configuration improvements.

Made the project template much better, with some CSS, and a Kajiki-based
layout.
This commit is contained in:
Jonathan LaCour
2010-10-12 11:46:31 -04:00
parent b7e444628e
commit 33719028fb
11 changed files with 150 additions and 33 deletions

View File

@@ -1,7 +1,9 @@
from paste.urlparser import StaticURLParser
from paste.cascade import Cascade
from weberror.errormiddleware import ErrorMiddleware
from paste.recursive import RecursiveMiddleware
from pecan import Pecan, request, response, override_template, redirect
from pecan import Pecan, request, response, override_template, redirect, error_for
from decorators import expose
__all__ = [
@@ -9,8 +11,10 @@ __all__ = [
]
def make_app(root, static_root=None, **kw):
def make_app(root, static_root=None, debug=False, errorcfg={}, **kw):
app = Pecan(root, **kw)
app = RecursiveMiddleware(app)
app = ErrorMiddleware(app, debug=debug, **errorcfg)
if static_root:
app = Cascade([StaticURLParser(static_root), app])
return app