Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    middlestorm 0.8.1

    Download button

    No screenshots available
    Downloads: 321  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Vsevolod Balashov | More programs
    LGPL v2 / FREE
    April 19th, 2010, 23:04 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    middlestorm description

    Middleware for use Storm ORM in WSGI applications

    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 can 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


    or in the Paste configuration:

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



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    Storm ORM | WSGI applications | Python library | Python | Middleware | Storm

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM