<s> """<STR_LIT>""" <EOL> import os , sys <EOL> path = os . path . join ( '<STR_LIT:.>' , os . path . dirname ( __file__ ) , '<STR_LIT>' ) <EOL> sys . path . append ( path ) <EOL> from flask import Flask , g , render_template <EOL> import flask_sijax <EOL> app = Flask ( __name__ ) <EOL> app . config [ "<STR_LIT>" ] = os . path . join ( '<STR_LIT:.>' , os . path . dirname ( __file__ ) , '<STR_LIT>' ) <EOL> app . config [ "<STR_LIT>" ] = '<STR_LIT>' <EOL> flask_sijax . Sijax ( app ) <EOL> class SijaxHandler ( object ) : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def _dump_data ( obj_response , files , form_values , container_id ) : <EOL> def dump_files ( ) : <EOL> if '<STR_LIT:file>' not in files : <EOL> return '<STR_LIT>' <EOL> file_data = files [ '<STR_LIT:file>' ] <EOL> file_name = file_data . filename <EOL> if file_name is None : <EOL> return '<STR_LIT>' <EOL> file_type = file_data . content_type <EOL> file_size = len ( file_data . read ( ) ) <EOL> return '<STR_LIT>' % ( file_name , file_type , file_size ) <EOL> html = """<STR_LIT>""" <EOL> html = html % ( str ( form_values ) , dump_files ( ) ) <EOL> obj_response . html ( '<STR_LIT>' % container_id , html ) <EOL> @ staticmethod <EOL> def form_one_handler ( obj_response , files , form_values ) : <EOL> SijaxHandler . _dump_data ( obj_response , files , form_values , '<STR_LIT>' ) <EOL> @ staticmethod <EOL> def form_two_handler ( obj_response , files , form_values ) : <EOL> SijaxHandler . _dump_data ( obj_response , files , form_values , '<STR_LIT>' ) <EOL> obj_response . reset_form ( ) <EOL> obj_response . html_append ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> yield obj_response <EOL> from time import sleep <EOL> sleep ( <NUM_LIT:2> ) <EOL> obj_response . html_append ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ flask_sijax . route ( app , "<STR_LIT:/>" ) <EOL> def index ( ) : <EOL> form_init_js = '<STR_LIT>' <EOL> form_init_js += g . sijax . register_upload_callback ( '<STR_LIT>' , SijaxHandler . form_one_handler ) <EOL> form_init_js += g . sijax . register_upload_callback ( '<STR_LIT>' , SijaxHandler . form_two_handler ) <EOL> if g . sijax . is_sijax_request : <EOL> return g . sijax . process_request ( ) <EOL> return render_template ( '<STR_LIT>' , form_init_js = form_init_js ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( debug = True , port = <NUM_LIT> ) </s>
