Skip to main content

Pymitter integration in Morepath

Project description

more.emit: pymitter integration in Morepath

This package provides Morepath integration for pymitter.

pymitter is a Python port of the extended Node.js EventEmitter 2 approach providing namespaces, wildcards and TTL.

Quick start

Install more.emit:

$ pip install -U more.emit

Extend your App class from EmitApp:

from more.pony import EmitApp

class App(EmitApp):

Now you can define signals:

from .app import App

def handler1(arg, request):
    print('handler1 called with', arg)

def handler2(arg, request):
    print('handler2 called with', arg)

You can emit the signals for example from the view:

def root_view(self, request):'myevent', 'foo', request)
    return {
        'name': 'Root'


An example for emitting signals on user creation and user update for sending a confirmation email. This example uses more.pony.

from .app import App

def send_confirmation_email(user, request):
    mailer ='mailer')
    mailer.send_confirmation_email(user, request)

@App.json(model=UserCollection, request_method='POST')
def user_collection_add(self, request):
    email = request.json['email']

    if not User.exists(email=email):
        user = self.add(email=email)

        def after(response):
  'user.email_updated', user, request)
            response.status = 201

        def after(response):
            response.status = 409

        return {
            'validationError': 'Email already exists'

@App.json(model=User, request_method='PUT')
def user_update(self, request):
    if 'email' in request.json and User.exists(email=request.json['email']):
        def after(response):
            response.status = 409

        return {
            'validationError': 'Email already exists'

        if 'email' in request.json:
            self.email_confirmed = False

            def after(response):
      'user.email_updated', self, request)


0.1 (2017-04-22)

  • initial public release.

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for more.emit, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size more.emit-0.1-py2.py3-none-any.whl (5.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size more.emit-0.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page