nicolaiarocci/eve — pull request #32 by tsileo (2013-04-05 16:43:15+00:00)
Title: Draft for a ResourceHook feature.

Hi, me again !

When working, I wanted to be able to trigger a celery task (another use case can be sending a message to websocket server) each time a user create a new resource.

So I tried to implement a basic ResourceHook (a ItemHook can also be implemented), the hook is enabled in settings.py.

Here is how my settings.py looks like:

``` python
from eve.utils import ResourceHook

class MyresourceHook(ResourceHook):
def get(self):
print "myresource get hook"

def post(self):
print "New myresource", self.document_id

myresource = {
'item_title': 'myresource',
'auth_username_field': 'user',
'resource_hook': MyresourceHook,
...
```

Tell me what you think about my implementation and about the idea.

Thanks !