Modules

wheezy.web.authorization

wheezy.web.authorization.authorize(wrapped=None, roles=None)[source]

Checks if user is accessing protected resource is authenticated and optionally in one of allowed roles.

roles - a list of authorized roles.

Check if call is authenticated:

class MyHandler(BaseHandler):
    @authorize
    def get(self):
        return response

Check if principal in role:

class MyHandler(BaseHandler):
    @authorize(roles=('operator', 'manager'))
    def get(self):
        return response
wheezy.web.authorization.secure(wrapped=None, enabled=True)[source]

Checks if user is accessing protected resource via SSL and if not, issue permanent redirect to HTTPS location.

enabled - whenever to do any checks (defaults to True).

Example:

class MyHandler(BaseHandler):
    @secure
    def get(self):
        ...
        return response

Using enabled:

class MyHandler(BaseHandler):
    @secure(enabled=False)
    def get(self):
        ...
        return response

wheezy.web.caching

caching module.

wheezy.web.templates

class wheezy.web.templates.Jinja2Template(env)[source]

Integration with Jinja2 templates.

class wheezy.web.templates.MakoTemplate(directories=None, module_directory='/tmp/mako_modules', cache=None, **kwargs)[source]

Integration with Mako templates.

class wheezy.web.templates.TenjinTemplate(path=None, pp=None, helpers=None, encoding='UTF-8', postfix='.html', cache=None, **kwargs)[source]

Integration with Tenjin templates.

class wheezy.web.templates.WheezyTemplate(engine)[source]

Integration with wheezy.template.

wheezy.web.transforms

transforms module

wheezy.web.transforms.handler_transforms(*transforms)[source]

Transforms is a way to manipulate handler response accordingly to some algorithm.

wheezy.web.handlers

handlers package.

wheezy.web.handlers.base

class wheezy.web.handlers.base.BaseHandler(request)[source]

Provides methods that integrate such features like: routing, i18n, model binding, template rendering, authentication, xsrf/resubmission protection.

You need inherit this class and define get() and/or post() to be able respond to HTTP requests.

class wheezy.web.handlers.base.PermanentRedirectRouteHandler(request, route_name, **route_args)[source]

Performs permanent redirect (HTTP status code 301) to given route name.

class wheezy.web.handlers.base.RedirectRouteHandler(request, route_name, **route_args)[source]

Redirects to given route name (HTTP status code 302).

wheezy.web.handlers.base.permanent_redirect_handler(route_name, **route_args)[source]

Performs permanent redirect (HTTP status code 301) to given route name.

wheezy.web.handlers.base.redirect_handler(route_name, **route_args)[source]

Redirects to given route name (HTTP status code 302).

wheezy.web.handlers.file

class wheezy.web.handlers.file.FileHandler(request, root)[source]

Serves static files out of some directory.

wheezy.web.handlers.file.file_handler(root)[source]

Serves static files out of some directory.

wheezy.web.handlers.method

class wheezy.web.handlers.method.MethodHandler(request)[source]

Represents the most generic handler. It serves dispatcher purpose for HTTP request method (GET, POST, etc). Base class for all handlers.

get()[source]

Responds to HTTP GET requests.

head()[source]

Responds to HTTP HEAD requests.

post()[source]

Responds to HTTP POST requests.

wheezy.web.handlers.method.new()

T.__new__(S, ...) -> a new object with type S, a subtype of T

wheezy.web.handlers.template

class wheezy.web.handlers.template.TemplateHandler(request)[source]

Serves templates that does not require up front data processing.

wheezy.web.handlers.template.template_handler(template_name, status_code=200, translation_name=None)[source]

Serves templates that does not require up front data processing.

wheezy.web.middleware

middleware package.

wheezy.web.middleware.errors

errors module.

class wheezy.web.middleware.errors.HTTPErrorMiddleware(error_mapping, logger, extra_provider=None)[source]

http error middleware

wheezy.web.middleware.errors.http_error_middleware_factory(options)[source]

HTTP error middleware factory.

wheezy.web.middleware.routing

routing module.

class wheezy.web.middleware.routing.PathRoutingMiddleware(path_router)[source]

path routing middleware

wheezy.web.middleware.routing.path_routing_middleware_factory(options)[source]

PathRouting middleware factory.