Commit 4b97fe0802d8c0afbc1c1924ffa6d867d2038c36
1 parent
80ff4efa
Exists in
handle_community_signals
Handle community creation and updated signals
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com>
Showing
2 changed files
with
24 additions
and
0 deletions
Show diff stats
src/colab_spb/apps.py
| 1 | 1 | |
| 2 | 2 | from django.apps import AppConfig |
| 3 | +from colab.signals.signals import connect_signal | |
| 4 | +from colab_spb.tasks import community_creation, community_updated | |
| 3 | 5 | |
| 4 | 6 | |
| 5 | 7 | class SpbAppConfig(AppConfig): |
| 6 | 8 | name = 'colab_spb' |
| 7 | 9 | verbose_name = 'SPB' |
| 10 | + | |
| 11 | + def connect_signal(self): | |
| 12 | + connect_signal('community_creation', 'noosfero', community_creation) | |
| 13 | + connect_signal('community_updated', 'noosfero', community_updated) | |
| 14 | + | ... | ... |
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +from colab.celery import app | |
| 2 | + | |
| 3 | + | |
| 4 | +@app.task(bind=True) | |
| 5 | +def community_creation(self, **kwargs): | |
| 6 | + f = open('/vagrant/community_creation', 'wb') | |
| 7 | + f.write(str(kwargs)) | |
| 8 | + f.close() | |
| 9 | + return 6 | |
| 10 | + | |
| 11 | + | |
| 12 | +@app.task(bind=True) | |
| 13 | +def community_updated(self, **kwargs): | |
| 14 | + f = open('/vagrant/community_updated', 'wb') | |
| 15 | + f.write(str(kwargs)) | |
| 16 | + f.close() | |
| 17 | + return 7 | ... | ... |