| 68 | | assert inspect.getargspec(receiver)[2] is not None, \ |
|---|
| 69 | | "Signal receivers must accept keyword arguments (**kwargs)." |
|---|
| | 69 | assert callable(receiver), "Signal receivers must be callable." |
|---|
| | 70 | |
|---|
| | 71 | # Check for **kwargs |
|---|
| | 72 | # Not all callables are inspectable with getargspec, so we'll |
|---|
| | 73 | # try a couple different ways but in the end fall back on assuming |
|---|
| | 74 | # it is -- we don't want to prevent registration of valid but weird |
|---|
| | 75 | # callables. |
|---|
| | 76 | try: |
|---|
| | 77 | argspec = inspect.getargspec(receiver) |
|---|
| | 78 | except TypeError: |
|---|
| | 79 | try: |
|---|
| | 80 | argspec = inspect.getargspec(receiver.__call__) |
|---|
| | 81 | except (TypeError, AttributeError): |
|---|
| | 82 | argspec = None |
|---|
| | 83 | if argspec: |
|---|
| | 84 | assert argspec[2] is not None, \ |
|---|
| | 85 | "Signal receivers must accept keyword arguments (**kwargs)." |
|---|