CherrypyElixir

Elixir plugin for cherrypy
Download

CherrypyElixir Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Price:
  • FREE
  • Publisher Name:
  • Vahid Mardani
  • Publisher web site:
  • http://pylover.dobisel.com/

CherrypyElixir Tags


CherrypyElixir Description

CherrypyElixir is a cherrypy plugin that provides elixir functionalities on top of sqlalchemy, within cherrypy as a process bus plugin.Example:import cherrypyimport CherrypyElixirfrom elixir import Entity, String, Field, OneToMany, Unicode, ManyToOneCherrypyElixir.setup()# define modelsclass Person(Entity): name = Field(String(128)) addresses = OneToMany('Address')class Address(Entity): email = Field(Unicode(128)) owner = ManyToOne('Person')class Root(object): @cherrypy.expose @cherrypy.tools.elixir() def index(self): yield '' for p in Person.query: yield '' yield p.name yield ' ' yield ','.join() yield '' yield '' @cherrypy.expose @cherrypy.tools.elixir() def add(self,name=None,address=None): p = Person(name = name) for addr in address.split(','): p.addresses.append(Address(email=addr))_cp_config={ 'global':{ 'server.socket_host' : '0.0.0.0', 'server.socket_port' : 1919, 'engine.elixir.on' : True, 'engine.elixir.echo' : True, 'engine.elixir.db_uri' : 'postgresql+psycopg2://postgres:password@localhost/test' },}if __name__ == '__main__': cherrypy.quickstart(Root(), '', config=_cp_config)To access sqlalchemy's scoped_session directly , you can use cherrypy.request.dbProduct's homepage


CherrypyElixir Related Software