Commit 5a7c659832a6ac56df9cac4f999ddfff357333e9
1 parent
4b97fe08
Exists in
handle_community_signals
Register and send signals create_repo and create_mail_list
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com> Signed-off-by: Lucas Moura <lucas.moura128@gmail.com>
Showing
2 changed files
with
12 additions
and
2 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 | |
3 | +from colab.signals.signals import connect_signal, register_signal | |
4 | 4 | from colab_spb.tasks import community_creation, community_updated |
5 | 5 | |
6 | 6 | |
... | ... | @@ -8,7 +8,12 @@ class SpbAppConfig(AppConfig): |
8 | 8 | name = 'colab_spb' |
9 | 9 | verbose_name = 'SPB' |
10 | 10 | |
11 | + short_name = 'spb' | |
12 | + signals_list = ['create_repo', 'create_mail_list'] | |
13 | + | |
14 | + def registered_signal(self): | |
15 | + register_signal(self.short_name, self.signals_list) | |
16 | + | |
11 | 17 | def connect_signal(self): |
12 | 18 | connect_signal('community_creation', 'noosfero', community_creation) |
13 | 19 | connect_signal('community_updated', 'noosfero', community_updated) |
14 | - | ... | ... |
src/colab_spb/tasks.py
1 | 1 | from colab.celery import app |
2 | +from colab.signals.signals import send | |
2 | 3 | |
3 | 4 | |
4 | 5 | @app.task(bind=True) |
... | ... | @@ -6,6 +7,10 @@ def community_creation(self, **kwargs): |
6 | 7 | f = open('/vagrant/community_creation', 'wb') |
7 | 8 | f.write(str(kwargs)) |
8 | 9 | f.close() |
10 | + | |
11 | + send('create_repo', 'spb') | |
12 | + send('create_mail_list', 'spb') | |
13 | + | |
9 | 14 | return 6 |
10 | 15 | |
11 | 16 | ... | ... |