from django.dispatch import Signal

#expect no return value
context_signal = Signal(providing_args=['request', 'context'])

#callback *could* return a new http response object
post_signal = Signal(providing_args=['request', 'form', 'extra'])

def last_response(responses):
    """ get the last response value from responses of a signal """
    try:
        return responses[-1][1]
    except:
        return None

from django.dispatch import Signal

#expect no return value
context_signal = Signal(providing_args=['request', 'context'])

#callback *could* return a new http response object
post_signal = Signal(providing_args=['request', 'form', 'extra'])

def last_response(responses, allow_none=False):
    """ get the last existing response value from responses of a signal """
    try:
        if allow_none:
            return responses[-1][1]
        else:
            return [response for response in responses if response[1] is not None][-1][1]
    except:
        return None

update of commit r405: correct a bug if a signal has multiple receivers and not the last one return a value