Exemplo n.º 1
0
def type_basichttp(session, data, sm, environ, raw=None):

    if "_scxmleventname" in data:
        evtname = data.pop("_scxmleventname")
        event = Event(evtname, data)
        event.origintype = "basichttp"
        event.origin = "unreachable"
    else:
        pth = filter(lambda x: bool(x), environ["PATH_INFO"].split("/")[3:])
        event = Event(["HTTP", environ['REQUEST_METHOD']] + pth, data=data)
        event.origintype = "basichttp"
        event.origin = "unreachable"

    event.raw = repr(environ) + "\n\n" + urllib.unquote(raw) + "\n"
    return event
Exemplo n.º 2
0
def type_basichttp(session, data, sm, environ, raw=None):
    
    if "_scxmleventname" in data:
        evtname = data.pop("_scxmleventname")
        event = Event(evtname, data)
        event.origintype = "basichttp"
        event.origin = "unreachable"
    else:
        pth = filter(lambda x: bool(x), environ["PATH_INFO"].split("/")[3:])
        event = Event(["HTTP", environ['REQUEST_METHOD']] + pth, data=data)
        event.origintype = "basichttp"
        event.origin = "unreachable"
        
        
    event.raw = repr(environ) + "\n\n" + urllib.unquote(raw) + "\n"
    return event
Exemplo n.º 3
0
 def send(self, name, data=None, invokeid = None, toQueue = None, sendid=None, eventtype="platform", raw=None, language=None):
     """Send an event to the statemachine 
     @param name: a dot delimited string, the event name
     @param data: the data associated with the event
     @param invokeid: if specified, the id of sending invoked process
     @param toQueue: if specified, the target queue on which to add the event
     
     """
     if isinstance(name, basestring): name = name.split(".")
     if not toQueue: toQueue = self.externalQueue
     evt = Event(name, data, invokeid, sendid=sendid, eventtype=eventtype)
     evt.origin = "#_scxml_" + self.dm.sessionid
     evt.origintype = ScxmlOriginType() if not isinstance(self.dm, ECMAScriptDataModel) else "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"
     evt.raw = raw
     #TODO: and for ecmascript?
     evt.language =  language
     toQueue.put(evt)
Exemplo n.º 4
0
def type_basichttp(session, data, sm, environ):
#    if "_scxmleventstruct" in data:
#        event = Processor.fromxml(data["_scxmleventstruct"], "unknown")
    
    if "_scxmleventname" in data:
        evtname = data.pop("_scxmleventname")
        event = Event(evtname, data)
        event.origintype = "basichttp"
        event.origin = "unreachable"
    else:
        pth = filter(lambda x: bool(x), environ["PATH_INFO"].split("/")[3:])
        event = Event(["HTTP", environ['REQUEST_METHOD']] + pth, data=data)
        event.origintype = "basichttp"
        event.origin = "unreachable"
        
        
    event.raw = repr(environ) + "\n\n" + urllib.unquote(environ["wsgi.input"].read()) + "\n"
    return event