Signals and listeners defined in a separate modules unusable in other apps

14 views
Skip to first unread message

Guruprasad L

unread,
Oct 8, 2011, 9:59:10 AM10/8/11
to django...@googlegroups.com
Hi,
I have a django project where I have defined some signals and listeners in a separate module (i.e., in a folder with __init__.py) in the files signals.py and listeners.py. These signals are to be used by multiple applications in the project. So I wrote the code connecting the signal to the listener in the models.py of one app. I placed a breakpoint there and it did get connected. 

The code triggering the signal is inside a view. But inside the view, when I debugged using breakpoints, the listener is no more connected to the signal and hence the event goes unhandled.

When the signals.py and listeners.py are in the same app in which the view function triggers the signal, things are working fine. What could be the issue here and how to work around it?

Thanks & Regards,
Guruprasad

Andy McKay

unread,
Oct 10, 2011, 12:14:46 AM10/10/11
to django...@googlegroups.com

On 2011-10-08, at 6:59 AM, Guruprasad L wrote:
> When the signals.py and listeners.py are in the same app in which the view function triggers the signal, things are working fine. What could be the issue here and how to work around it?

Most likely your signals and listeners aren't being imported. Stick a print statement in the module to confirm this is the case. If so, import them.
--
Andy McKay
an...@clearwind.ca
twitter: @andymckay

Reply all
Reply to author
Forward
0 new messages