def process_request(self, request): """This method is called by the Django framework when a *request* hits the server. """ flash = storage.get(request) or FlashScope() flash.update() setattr(request, CONTEXT_VAR, flash)
def _get_flash_from_storage(request): """Gets the flash from the storage, adds it to the given request and returns it. A new :class:`FlashScope` is used if the storage is empty. """ flash = storage.get(request) or FlashScope() setattr(request, CONTEXT_VAR, flash) return flash