<s> """<STR_LIT>""" <EOL> from datetime import timedelta <EOL> from django . utils . timezone import now <EOL> from django_downloadview . response import ( ProxiedDownloadResponse , <EOL> content_disposition ) <EOL> from django_downloadview . utils import content_type_to_charset , url_basename <EOL> class XAccelRedirectResponse ( ProxiedDownloadResponse ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , redirect_url , content_type , basename = None , expires = None , <EOL> with_buffering = None , limit_rate = None , attachment = True ) : <EOL> """<STR_LIT>""" <EOL> super ( XAccelRedirectResponse , self ) . __init__ ( content_type = content_type ) <EOL> if attachment : <EOL> self . basename = basename or url_basename ( redirect_url , <EOL> content_type ) <EOL> self [ '<STR_LIT>' ] = content_disposition ( self . basename ) <EOL> self [ '<STR_LIT>' ] = redirect_url <EOL> self [ '<STR_LIT>' ] = content_type_to_charset ( content_type ) <EOL> if with_buffering is not None : <EOL> self [ '<STR_LIT>' ] = with_buffering and '<STR_LIT:yes>' or '<STR_LIT>' <EOL> if expires : <EOL> expire_seconds = timedelta ( expires - now ( ) ) . seconds <EOL> self [ '<STR_LIT>' ] = expire_seconds <EOL> elif expires is not None : <EOL> self [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if limit_rate is not None : <EOL> self [ '<STR_LIT>' ] = limit_rate and '<STR_LIT>' % limit_rate or '<STR_LIT>' </s>
