Previous topic

vesper.data.DataStore

Next topic

<no title>

This Page

vesper.app

This module defines the framework used by Vesper to bootstrap a running server from a given configuration.

class vesper.app.Action(action, cachePredicate=<function notCacheableKeyPredicate at 0x2d98de8>, sideEffectsPredicate=None, sideEffectsFunc=None, isValueCacheableCalc=<function defaultActionValueCacheableCalc at 0x2d98e60>, cachePredicateFactory=<function defaultActionCacheKeyPredicateFactory at 0x2d92c08>, debug=False)

The Action class encapsulates a step in the request processing pipeline.

An Action has two parts, one or more match expressions and an action function that is invoked if the request metadata matches one of the match expressions. The action function returns a value which is passed onto the next Action in the sequence.

exception vesper.app.DoNotHandleException
RequestProcessor.doActions() will not invoke error handler actions on exceptions derived from this class.
class vesper.app.Requestor(server, triggerName=None)

Requestor is a helper class that allows python code to invoke a vesper request as if it was function call

Usage: response = __requestor__.requestname(**kw) where kw is the optional request parameters

An AttributeError exception is raised if the server does not recognize the request

vesper.app.argsToKw(argv)
vesper.app.assignAttrs(obj, configDict, varlist, default)
Helper function for adding attributes to an object given a dictionary of configuration properties
vesper.app.createApp(derivedapp=None, baseapp=None, static_path=(), template_path=(), actions=None, **config)

Create a new AppConfig.

Parameters:
  • derivedapp – is the name of the module that is extending the app. (Usually just pass __name__)
  • baseapp – is either a module name or a file path to the Python script that defines an app. This file should have a call to createApp() in it
  • static_path – list or string prepended to the static resource path of the app.
  • template_path – list or string prepended to the template resource path of the app.
  • actions – actions map of the app, will updates the base app’s action dictionary.
  • config – Any other keyword arguments will override config values set by the base app
vesper.app.defaultActionCacheKeyPredicateFactory(action, cacheKeyPredicate)
Returns a predicate to calculate a key for the action based on a given request. This function gives an action a chance to customize the cacheKeyPredicate for the particulars of the action instance. At the very least it should bind the action instance with the cacheKeyPredicate to disambiguate keys from different actions.