Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: Can signal receivers return data?

Tags:

django

In Django, can signals be used as callback functions? In other words, can the "sender" of a signal use it to gather data from another app, via the return value of send()?

like image 974
zer0stimulus Avatar asked Jul 22 '12 00:07

zer0stimulus


1 Answers

Yes.

Both send() and send_robust() return a list of tuple pairs [(receiver, response), ... ], representing the list of called receiver functions and their response values.

Do note that this is rather a rather unorthodox mechanism for this though; if you need the return value from a function, just call it directly.

like image 167
Ignacio Vazquez-Abrams Avatar answered Sep 29 '22 11:09

Ignacio Vazquez-Abrams