Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython

middlestorm is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.8.1 Failed View build log
Windows (64-bit)
0.8.1 Failed View build log
Mac OS X (10.5+)
0.8.1 Failed View build log
Linux (32-bit)
0.8.1 Failed View build log
Linux (64-bit)
0.8.1 Failed View build log
 
Links
License
LGPL 2.1
Dependencies
Lastest release
version 0.8.1 on Jan 5th, 2011

Introduction

Storm is a fast, small and powerful object-relational mapper. Try it to use in web-aware applications.

WSGI application mainly miltithreaded, but Store object is not thread safe.

Middlestorm middleware manage Store objects (one per thread) and add it into environ dictonary.

Simple example

There are 3 ways to create middleware:
  • class
  • decorator
  • Paste configuration

Class middleware:

from wsgiref.simple_server import make_server
from storm.database import create_database

from middlestorm import MiddleStorm

def storm_app(environ, start_response):
    store = environ['storm.store']
    # ...

db = create_database('postgres://user:password@host/base')
app = MiddleStorm(storm_app, db)

make_server('', 8000, app).serve_forever()

Decorator middleware:

from wsgiref.simple_server import make_server
from storm.database import create_database

import middlestorm

@middlestorm.decorator(create_database('postgres://user:password@host/base'))
def storm_app(environ, start_response):
    store = environ['storm.store']
    # ...

make_server('', 8000, storm_app).serve_forever()

To create middleware via Paste configuration, add a stanza to the .ini file:

[filter:middlestorm]
use = middlestorm#middlestorm
db_uri = sqlite:myapp.db

and then add that filter to the Paste pipeline (again, in the .ini file):

[pipeline:main]
pipeline =
    middlestorm
    myapp

By default Store placed in variable storm.store. This can be customized:

app = MiddleStorm(storm_app, db, key='custom.mystore')

or decorator style:

@middlestorm.decorator(db, key='custom.mystore')
def storm_app(environ, start_response):
    store = environ['custom.mystore']

or in the Paste configuration:

[filter:middlestorm]
use = middlestorm#middlestorm
db_uri = sqlite:myapp.db
key = myapp.store

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.