Exemple #1
0
def Load_EiEventStore(filename=sysCfg.EIEVENT_STORE):
    # if the EiEvent configuration file does not exist
    # then simple return {}
    if not os.path.exists(filename):
        logging.debug('Unable to load EiEvent(s) Information; ' \
                      '%s not present' % filename)
        return {}
    with open(filename, 'r') as file_h:
        EiEventCfg = json.load(file_h)
    event_store = {}
    for eventId, event in EiEventCfg.iteritems():
        event_d = str_to_eievent(event)
        event_store[eventId] = EiEvent(**event_d)
    logging.debug('Loaded %d EiEvents(s) from %s' % \
                 (len(EiEventCfg), filename))
    return event_store
Exemple #2
0
                        'signalPayload' : form.getvalue('signalPayload_%d_%d' % (signal, interval)),
                        'duration'      : form.getvalue('duration_%d_%d' % (signal, interval)),
                    }
                    interval_list.append(i)
            eiEventSignal['intervals'] = interval_list
            eiEventSignals.append(eiEventSignal)
    eiEvent['eiEventSignals'] = eiEventSignals    
    # eiTarget
    eiEvent['eiTarget'] = {
    'groupID'    : groupID,
    'resourceID' : resourceID,
    'venID'      : venID,
    'partyID'    : partyID,
    }

    eiEvent = str_to_eievent(eiEvent)
    
    try:
        event = EiEvent(**eiEvent)
        em = EiEventManager()
        em.addEiEvent(event)
        output = "Event added successfully!!"
        if action == 'edit':
            if old_id != event.eventDescriptor.eventID:
                em.removeEiEvent(old_id)
            output = "Event updated successfully!!"
    except Exception, e:
        output = e
        raise
    next_page = VIEW_EVENT