[17/Sep/2009:19:20] Release 0.5 includes Open Flash Chart support.

[01/Jul/2009:10:50] Repoze.who authentication tutorial added

[22/Jun/2009:11:36] AJAX calculator tutorial added.

[01/May/2009:14:15] MVC/SQL based wiki tutorial added.

Contact Email:

view source

Download instructions
project page

Resource Management

A resource is an object which a web application can use to get information from the server environment or store information to the server environment. WSGI applications can use WHIFF API's to find and manipulate resources.

Paths and access
The WHIFF resource abstraction provides a flexible naming scheme for applications to read and write external resources. The WHIFF resource infrastructure allows resources to be
Any number of resources may be attached to an application.
Configured at deployment
Different installations can configure resources using filters that implement accesses to the same resource name in different ways.  
For example an installation of the resumes demo under single threaded server might be configured to maintain HTTP session objects in memory, whereas an installation of resumes under a multi-process CGI based server might be configured to store HTTP session information in files.
WHIFF configuration templates must access resources via the resource configuration provided for the application. This prevents configuration templates from accessing or modifying data not accessible through the interface.  
For example a configuration template may enquire about the current user's profile data, but it may not access the profile data for any other user using the user profile interface.
Resource filters can be implemented to support caching and reuse.  
For example resource filters can cache commonly used data in memory and implement techniques like database connection pooling.
For an example of deploying and using resources please see the "wizard" tutorial.


Resources are attached to an application root directory when the directory is configured. A resource attached to a directory has a prefix which is used in applications to name the resource and a filter which is used by the infrastructure to locate resources with that prefix (or refuse to locate them). For example the following assignment constructs a root application
testapp = resolver.moduleRootApplication("/", root)
The following assignment creates a resource that allows access to a data file mediated by a password
filefinder = gateway.FileFinder("secretpassword", "/tmp/testfile.txt")
And this method call attaches the finder for the data file to the root application
testapp.registerResourceFinder(prefix="datafile", finder=filefinder)

Paths and access

Applications get access to resources by naming the resource with a path list. For example the following configuration directive evaluates to the contents of the datafile resource configured above
{{include "whiff_middleware/getResource"}} 
    ["datafile", "secretpassword"] 
Applications may attempt to get or put a resource (and the attempt may be refused). The following directive puts the datafile resource deployed above
{{include "whiff_middleware/putResource"}}
	{{using path}} ["datafile", "secretpassword"] {{/using}}
	{{using value}} NEW CONTENT FOR THE FILE {{/using}}
Resources may be implemented as any sort of object.


Resource filters are responsible for assigning resources upon request or for refusing to assign resources when access is not permitted. For a given path a filter may assign a new resource or a shared resource based on the context and environment of the application requesting the resource and the semantics of the resources.  
For example, a "random number" resource may assign a new value at every request, or a "HTTP session" may assign a value shared only by different accesses by the same client, or a "database" resource may assign a single global object shared by all accesses to the root directory.
Care to comment?
name: (required)
- email (not published):
comment: (required)

<< security number? >>