Cherrypy’s Elixir Plugin
CherrypyElixir is a cherrypy plugin that provides elixir functionalities on top of sqlalchemy , within cherrypy as a process bus plugin.
Example:
import cherrypy
import CherrypyElixir
from elixir import Entity, String, Field, OneToMany, Unicode, ManyToOne
CherrypyElixir.setup()
# define models
class 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 '<ul>'
for p in Person.query:
yield '<li>'
yield p.name
yield ' '
yield ','.join([a.email for a in p.addresses])
yield '</li>'
yield '</ul>'
@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' : 'sqlite://test.db'
},
}
if __name__ == '__main__':
cherrypy.quickstart(Root(), '', config=_cp_config)
To access sqlalchemy’s scoped_session directly , you can use cherrypy.request.db
Metadata
Release files for CherrypyElixir 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| CherrypyElixir-0.5.1.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| CherrypyElixir-0.5.1-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 8.6 kB
Release files / CherrypyElixir-0.5.1.tar.gz
| Download URL | CherrypyElixir-0.5.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec4881280f97b977f5ee7a0618c77897f124899095317261a8eac6be2c36fceb
|
|
BLAKE2b-256 checksum How to use checksums |
ae952212961c2483f47418315a5071914e0101253bb29dc4f29727c810d63768
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / CherrypyElixir-0.5.1-py2.7.egg
| Download URL | CherrypyElixir-0.5.1-py2.7.egg |
|---|---|
| Size | 5.4 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
127498a84cb79056a3abae109d8de39c4113d45d0af81453c35cd313477bb626
|
|
BLAKE2b-256 checksum How to use checksums |
1b481bf6048471b4c616f8892b8c3ab5347db136bd663ef85b0fdee7d04fba2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for CherrypyElixir 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.