def main(environ, start_response): ''' Перенаправляет запросы по "do_what" ''' fs = FieldStorage(fp=environ['wsgi.input'], environ=environ) mycgi = util.cook_cgi(fs) if 'do_what' not in mycgi: mycgi['do_what'] = 'list' do_what = mycgi['do_what'] functions = { 'get_domain_admins': {'exec': get_domain_admins}, 'remove_domain_admin': {'exec': remove_domain_admin}, 'add_domain_admin': {'exec': add_domain_admin}, 'set_default_domain_email': {'exec': set_default_domain_email}, 'set_new_domain_logo': {'exec': set_new_domain_logo}, 'delete_domain_logo': {'exec': delete_domain_logo}, 'delete_domain': {'exec': delete_domain} } if do_what not in functions: return ['<br><br><br><div align="center"><p>Произошло страшное</p></div>'.encode('utf-8')] return functions[do_what]['exec'](mycgi, environ) if do_what!='set_new_domain_logo' else functions[do_what]['exec'](mycgi, environ, fs)
def main(environ, start_response): ''' Перенаправляет запросы по "do_what" ''' mycgi = util.cook_cgi(FieldStorage(environ=environ)) if 'do_what' not in mycgi: mycgi['do_what'] = 'list' do_what = mycgi['do_what'] functions = { 'list': {'exec': make_head}, # 'list_users_ajax': {'exec': list_users_ajax}, 'refresh_users_list': {'exec': refresh_users_list}, 'get_user_info': {'exec': get_user_info}, 'get_forwards_list': {'exec': get_forwards_list}, 'get_recieves_list': {'exec': get_recieves_list}, 'add_forward': {'exec': add_forward}, 'edit_forward': {'exec': edit_forward}, 'remove_forwards': {'exec': remove_forwards}, 'save_user_info': {'exec': save_user_info}, 'delete_user': {'exec': delete_user} } if do_what not in functions: return ['<br><br><br><div align="center"><p>Произошло страшное</p></div>'.encode('utf-8')] return functions[do_what]['exec'](mycgi, environ)
def main(environ, start_response): ''' Перенаправляет запросы по "do_what" ''' mycgi = util.cook_cgi(FieldStorage(environ=environ)) do_what = mycgi['do_what'] functions = { 'get_settings': {'exec': get_settings}, 'get_server_start_time': {'exec': get_server_start_time} } if do_what not in functions: return ['<br><br><br><div align="center"><p>Произошло страшное</p></div>'.encode('utf-8')] return functions[do_what]['exec'](mycgi, environ)
def main(environ, start_response): ''' Перенаправляет запросы по "do_what" ''' mycgi = util.cook_cgi(FieldStorage(environ=environ)) if 'do_what' not in mycgi: mycgi['do_what'] = 'list' do_what = mycgi['do_what'] functions = { 'list': { 'exec': make_head }, # 'list_users_ajax': {'exec': list_users_ajax}, 'refresh_users_list': { 'exec': refresh_users_list }, 'get_user_info': { 'exec': get_user_info }, 'get_forwards_list': { 'exec': get_forwards_list }, 'get_recieves_list': { 'exec': get_recieves_list }, 'add_forward': { 'exec': add_forward }, 'edit_forward': { 'exec': edit_forward }, 'remove_forwards': { 'exec': remove_forwards }, 'save_user_info': { 'exec': save_user_info }, 'delete_user': { 'exec': delete_user } } if do_what not in functions: return [ '<br><br><br><div align="center"><p>Произошло страшное</p></div>'. encode('utf-8') ] return functions[do_what]['exec'](mycgi, environ)
def main(environ, start_response): ''' Перенаправляет запросы по "do_what" ''' mycgi = util.cook_cgi(FieldStorage(environ=environ)) do_what = mycgi['do_what'] functions = { 'get_settings': { 'exec': get_settings }, 'get_server_start_time': { 'exec': get_server_start_time } } if do_what not in functions: return [ '<br><br><br><div align="center"><p>Произошло страшное</p></div>'. encode('utf-8') ] return functions[do_what]['exec'](mycgi, environ)