(title, ldap, description, reason, url='N/A', key=None)
Creates a new alert in the SQL DB with an optionally random hash.
Creates a new alert in the SQL DB with an optionally random hash.
Creates a new alert in the SQL DB with an optionally random hash .
def create_new_alert(title, ldap, description, reason, url='N/A', key=None):
    # type: (str, str, str, str, str, str) -> None
    '''
    Creates a new alert in the SQL DB with an optionally random hash.
    '''
    # Generate random key if none provided
    if key is None:
        key = binascii.hexlify(os.urandom(32))

    # Insert that into the database as a new alert
    SQLEngine.execute('''
    INSERT INTO alerts (hash, ldap, title, description, reason, url, event_time)
    VALUES (UNHEX(%s), %s, %s, %s, %s, %s, NOW())
    ''',
    (key, ldap, title, description, reason, url))

    SQLEngine.execute('''
    INSERT INTO user_responses (hash, comment, performed, authenticated)
    VALUES (UNHEX(%s), '', false, false)
    ''',
    (key,))

    SQLEngine.execute('INSERT INTO alert_status (hash, status) VALUES (UNHEX(%s), 0)',
                      (key,))
def create_new_alert ( title , ldap , description , reason , url = 'N/A' , key = None ) : # type: (str, str, str, str, str, str) -> None # Generate random key if none provided if key is None : key = binascii . hexlify ( os . urandom ( 32 ) ) # Insert that into the database as a new alert SQLEngine . execute ( '''
    INSERT INTO alerts (hash, ldap, title, description, reason, url, event_time)
    VALUES (UNHEX(%s), %s, %s, %s, %s, %s, NOW())
    ''' , ( key , ldap , title , description , reason , url ) ) SQLEngine . execute ( '''
    INSERT INTO user_responses (hash, comment, performed, authenticated)
    VALUES (UNHEX(%s), '', false, false)
    ''' , ( key , ) ) SQLEngine . execute ( 'INSERT INTO alert_status (hash, status) VALUES (UNHEX(%s), 0)' , ( key , ) )