views:

15

answers:

1

I want to create events for my classes.

Say I create a CMS application that has a Article object.

I create events like:

OnEdit
OnCreate
OnDelete
PreCreate
PreDelete

Now I want someone to be able to hook into these events, and add their custom functionality at each event they wish.

I don't want them touching the core source code, so they would have to wire these custom methods to fire somewhere else.

I'm new to both python and django so please be as detailed as possible if you can.

+1  A: 

Signals are what you want. You can define custom signals in your application and send them when certain events happen, then users can get their code to listen to these signals and take any action they want.

Daniel Roseman
cool so it passes the object when you send the signal, so the client can modify it.
Blankman