コード例 #1
0
ファイル: EventAgent.py プロジェクト: gklyne/webbrick-events
def makeEventAgent(uri=None):
    """
    Make a new event agent value using the supplied URI.
    
    If no URI is supplied, a new value may be generated.
    """
    global EventAgentSequence
    if not uri:
        EventAgentSequence += 1
        seq = EventAgentSequence
        uri = EventAgentBase+uriDate()+"/"+uriTime()+"/"+str(seq)
    return EventAgent(uri)
コード例 #2
0
def makeEventAgent(uri=None):
    """
    Make a new event agent value using the supplied URI.
    
    If no URI is supplied, a new value may be generated.
    """
    global EventAgentSequence
    if not uri:
        EventAgentSequence += 1
        seq = EventAgentSequence
        uri = EventAgentBase + uriDate() + "/" + uriTime() + "/" + str(seq)
    return EventAgent(uri)
コード例 #3
0
def makeEventHandler(uri=None, handler=None, initSubscription=None, endSubscription=None):
    """
    Make a new event handler value using the supplied URI.
    
    'uri'       is an identifying URI for this handler.
    'handler'   is a function called when a subscribed event is published, with the 
                new event handler itself as its first argument, and the event object
                as its second argument.
    'initSubscription' and 'endSubscription' are called with the new event handler 
                itself as their first argument, and the status code as their second.
                TODO: review this to consider also providing event type/source values
    
    If no URI is supplied, a new value may be generated.
    """
    global EventTargetSequence
    if not uri:
        EventTargetSequence += 1
        seq = EventTargetSequence
        uri = EventTargetBase+uriDate()+"/"+uriTime()+"/"+str(seq)
    return EventHandler(uri, handler, initSubscription, endSubscription)
コード例 #4
0
def makeEventHandler(uri=None,
                     handler=None,
                     initSubscription=None,
                     endSubscription=None):
    """
    Make a new event handler value using the supplied URI.
    
    'uri'       is an identifying URI for this handler.
    'handler'   is a function called when a subscribed event is published, with the 
                new event handler itself as its first argument, and the event object
                as its second argument.
    'initSubscription' and 'endSubscription' are called with the new event handler 
                itself as their first argument, and the status code as their second.
                TODO: review this to consider also providing event type/source values
    
    If no URI is supplied, a new value may be generated.
    """
    global EventTargetSequence
    if not uri:
        EventTargetSequence += 1
        seq = EventTargetSequence
        uri = EventTargetBase + uriDate() + "/" + uriTime() + "/" + str(seq)
    return EventHandler(uri, handler, initSubscription, endSubscription)