Fork me on GitHub

Applications

An application is exposed to Jove by registering an entry point in your project’s setup.py of type jove.application which points to a class which implements the interface described by jove.interfaces.Application.

In your project’s setup.py:

setup(name='myproject',
      etc...,
      entry_points = """\
          [jove.application]
          myapp = myproject.application:Application
      """
      )

In your project’s application.py:

from jove.interfaces import Application

from myproject.models.site import make_site

class MyProject(Application):

    def configure(self, config):
        config.set_session_factory(session_factory)
        config.scan('myproject')

    def make_site(self):
        return make_site()
class jove.interfaces.Application(settings)

Concrete subclasses of Application define applications that can be run inside of Jove.

configure(config)

Performs the necessary Pyramid setup for the application, such as registering views, etc... The config parameter is an instance of pyramid.config.Configurator. In general a Jove application is set up in the same as a Pyramid application. See the Pyramid documentation for more information. The actual WSGI application is created by Jove. There is no need to call config.make_wsgi_app() in this method. This method has no return value.

initial_settings()

Returns a Colander appstruct which contains initial values for the settings used by this application. The appstruct must be valid according to the schema returned by the settings_schema method.

make_pipeline(app)

This method can be used to optionally add middleware to the WSGI pipeline used by the application. The app parameter is the fully configured Pyramid WSGI application created by Jove. Applications which require middleware in the WSGI stack may compose their middleware stack in this method and return the resulting pipeline, which will also be a WSGI application. By default this method simply returns app.

make_site(home, site)

This method is responsible for bootstrapping a site which uses this application. This method is expected to return a persistent.Persistent object which is the initial site root for this site. This is the object that will be returned by the Pyramid root factory configured by Jove.

services()

Indicates the services required by this application. Returns an iterable sequence of tuples of the form (‘package#entry_point’, descriptor) where the entry point refers to setuptools entry point of type ‘jove.local_service’. The descriptor is an arbitrary Python object used to further configure the service. Each service will publish its own expectations regarding the properties of the descriptor.

settings_schema()

This function returns a Colander schema which describes the settings used by this application. By use of the schema, application settings can be handled by Jove’s command line and as well as by a hypothetical future administrative web interface.

Previous topic

Sites

Next topic

Settings