コード例 #1
0
 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)
コード例 #2
0
ファイル: middleware.py プロジェクト: miracle2k/django-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
コード例 #3
0
ファイル: middleware.py プロジェクト: duct-tape/django-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