Changes between Initial Version and Version 1 of Ticket #31949, comment 3


Ignore:
Timestamp:
Aug 27, 2020, 12:34:13 AM (4 years ago)
Author:
Michael Galler

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31949, comment 3

    initial v1  
    33>
    44> An issue with the MiddlewareMixin subclasses is already handled in #31928.
    5 I hadn't opened the ticket, so that's already addressed.
     5I had not checked the ticket, so that's already addressed.
    66>
    77> You should be able to chain them with `@sync_to_async()`, if necessary. Am I missing sth?
     
    3232{{{
    3333def xframe_options_deny(view_func):
    34       def wrapped_view(*args, **kwargs):
    35         resp = view_func(*args, **kwargs)
     34    def process_response(resp):
    3635        if resp.get('X-Frame-Options') is None:
    3736            resp['X-Frame-Options'] = 'DENY'
    3837        return resp
    3938
     39    def wrapped_view(*args, **kwargs):
     40        resp = view_func(*args, **kwargs)
     41        return process_response(resp)
     42
    4043    async def wrapped_view_async(*args, **kwargs):
    4144        resp = await view_func(*args, **kwargs)
    42         if resp.get('X-Frame-Options') is None:
    43             resp['X-Frame-Options'] = 'DENY'
    44         return resp
     45        return process_response(resp)
    4546
    4647    return wraps(view_func)(wrapped_view_async if asyncio.iscoroutinefunction(view_func) else wrapped_view)
Back to Top