Exemplo n.º 1
0
def choose_service(Services):
    Service.show_service_list(Services)
    print
    while True:
        service_id = raw_input('Please select the Service ID to continue:')
        service = Service.find_service(Services, service_id)
        if service is None:
            print 'Invalid Service ID, please re-select one'
        else:
            break
    return service
Exemplo n.º 2
0
def show_servicelist(Services):
    Service.show_service_list(Services)
    while True:
        input_sid = raw_input('Select one Service ID for the service:')
        #input_sid = '201'
        if len(filter(lambda service: service.sid == input_sid, Services)) == 0:
            print 'The Service ID is not listed on the service list!'
            continue
        else:
            break
    return input_sid
Exemplo n.º 3
0
def delete_service(Services):
    while True:
        Service.show_service_list(Services)
        input = raw_input('Please enter the service id for deletion:')
        service = Service.find_service(Services, input)
        if service is None:
            print 'Invalid service id. Please re-enter a new one!'
            print
        else:
            break
    pickle_file = service_folder + service.name + '.pkl'
    os.remove(pickle_file)
    Services.remove(service)
    print 'Delete Service \'' + service.name + '\' Succeed!'