<s> """<STR_LIT>""" <EOL> from django . core . files . uploadhandler import FileUploadHandler , StopUpload <EOL> class QuotaUploadHandler ( FileUploadHandler ) : <EOL> """<STR_LIT>""" <EOL> QUOTA = <NUM_LIT:5> * <NUM_LIT:2> ** <NUM_LIT:20> <EOL> def __init__ ( self , request = None ) : <EOL> super ( QuotaUploadHandler , self ) . __init__ ( request ) <EOL> self . total_upload = <NUM_LIT:0> <EOL> def receive_data_chunk ( self , raw_data , start ) : <EOL> self . total_upload += len ( raw_data ) <EOL> if self . total_upload >= self . QUOTA : <EOL> raise StopUpload ( connection_reset = True ) <EOL> return raw_data <EOL> def file_complete ( self , file_size ) : <EOL> return None <EOL> class CustomUploadError ( Exception ) : <EOL> pass <EOL> class ErroringUploadHandler ( FileUploadHandler ) : <EOL> """<STR_LIT>""" <EOL> def receive_data_chunk ( self , raw_data , start ) : <EOL> raise CustomUploadError ( "<STR_LIT>" ) </s>
