machinalis / telegraphy

Telegraphy provides real time events for WSGI Python applications
202 stars 15 forks source link

Rename ModelEvent to EventSender #9

Open D3f0 opened 10 years ago

D3f0 commented 10 years ago

Actual event is just a JSON or dict, but ModelEvent instances are just responibles of event emission.

D3f0 commented 9 years ago

This has to be reviewed. Telegraphy original approach to signal/broadcaster approach seems quite limited now. Maybe we'll take some inspiration from https://github.com/zapier/django-rest-hooks/blob/master/README.md

More precicely

HOOK_EVENTS = {
    # 'any.event.name': 'App.Model.Action' (created/updated/deleted)
    'book.added':       'bookstore.Book.created',
    'book.changed':     'bookstore.Book.updated',
    'book.removed':     'bookstore.Book.deleted',
    # and custom events, no extra meta data needed
    'book.read':         None,
    'user.logged_in':    None
}