Exemplo n.º 1
0
def create_selection_pack(i_request, i_blank=0):
    a = 4
    a = a * a

    con = get_mdatabase_connection()

    return_pack = Selection_Pack(con)

    if ('POST' == i_request.method):
        return_pack.initialize_data(i_request.POST, i_blank)
    else:
        default_post = QueryDict('')
        default_post = default_post.copy()
        default_post.update({'controller_names': ALL_CONTROLLERS_STRING})
        default_post.update({'access_points': ALL_ACCESS_POINTS_STRING})
        default_post.update({'buildings': ALL_BUILDINGS_STRING})
        default_post.update({'entry_begin': '0'})
        default_post.update({'num_entries': '10000'})

        default_post.update({'loss_low': '0'})
        default_post.update({'loss_high': '100'})
        default_post.update({'retry_low': '0'})
        default_post.update({'retry_high': '100'})
        default_post.update({'thru_low': '0'})
        default_post.update({'thru_high': '100'})
        default_post.update({'beacon_low': '0'})
        default_post.update({'beacon_high': '100'})
        default_post.update({'probe_low': '0'})
        default_post.update({'probe_high': '100'})
        default_post.update({'date_range_low': DEFAULT_BEGINING_TIME})
        default_post.update(
            {'date_range_high': time.strftime('%Y-%m-%d %H:%M:%S')})
        return_pack.initialize_data(default_post, i_blank)

    return return_pack
Exemplo n.º 2
0
def get_context(i_request):
	selection_pack = create_selection_pack(i_request, 1)
	context = {'selection_pack' : selection_pack}
	context['form_names'] = Controller_Tag_Form_Names()
	context ['form_values'] = Controller_Tag_Form_Values()
	context['output_str'] = 'Controller Tag'
	

	form_names = context['form_names']
	if('POST' != i_request.method):
		return context

	print('Posted')
	post_vals = i_request.POST

	if(not post_vals.has_key(form_names.add_tags)):
		return context

	print('Post Val: ', post_vals[form_names.add_tags])


	con = get_mdatabase_connection()
	cursor = con.cursor()

	for controller_name in selection_pack.selected_controllers:
		
		add_tag_to_database(cursor, 'Controllers', controller_name, post_vals['tag_1'])
		add_tag_to_database(cursor, 'Controllers', controller_name, post_vals['tag_2'])
		add_tag_to_database(cursor, 'Controllers', controller_name, post_vals['tag_3'])
		add_tag_to_database(cursor, 'Controllers', controller_name, post_vals['tag_4'])

	for building_name in selection_pack.selected_buildings:
		
		add_tag_to_database(cursor, 'Buildings', building_name, post_vals['tag_1'])
		add_tag_to_database(cursor, 'Buildings', building_name, post_vals['tag_2'])
		add_tag_to_database(cursor, 'Buildings', building_name, post_vals['tag_3'])
		add_tag_to_database(cursor, 'Buildings', building_name, post_vals['tag_4'])

	for access_point in selection_pack.selected_aps:
		
		add_tag_to_database(cursor, 'Access_Points', access_point, post_vals['tag_1'])
		add_tag_to_database(cursor, 'Access_Points', access_point, post_vals['tag_2'])
		add_tag_to_database(cursor, 'Access_Points', access_point, post_vals['tag_3'])
		add_tag_to_database(cursor, 'Access_Points', access_point, post_vals['tag_4'])

	con.commit()		
		
	return context
Exemplo n.º 3
0
def create_selection_pack(i_request, i_blank = 0):
	a = 4;
	a = a*a;



	con = get_mdatabase_connection()

	return_pack = Selection_Pack(con)

	if('POST' == i_request.method):
		return_pack.initialize_data(i_request.POST, i_blank)
	else:
		default_post = QueryDict('')
		default_post = default_post.copy()
		default_post.update({'controller_names' : ALL_CONTROLLERS_STRING})
		default_post.update({'access_points' : ALL_ACCESS_POINTS_STRING})
		default_post.update({'buildings' : ALL_BUILDINGS_STRING})
		default_post.update({'entry_begin' : '0'})
		default_post.update({'num_entries' : '10000'})
		
		default_post.update({'loss_low' : '0' })
		default_post.update({'loss_high' : '100' })
		default_post.update({'retry_low' : '0' })
		default_post.update({'retry_high' : '100' })
		default_post.update({'thru_low' : '0' })
		default_post.update({'thru_high' : '100' })
		default_post.update({'beacon_low' : '0' })
		default_post.update({'beacon_high' : '100' })
		default_post.update({'probe_low' : '0' })
		default_post.update({'probe_high' : '100' })
		default_post.update({'date_range_low' : DEFAULT_BEGINING_TIME})
		default_post.update({'date_range_high' : time.strftime('%Y-%m-%d %H:%M:%S')})
		return_pack.initialize_data(default_post, i_blank)
		 
	return return_pack