# pi.py # http://pi-js.googlecode.com # developer: azer koculu def getOutput(data,cometType,cometName): "Returns fixed output by cometType" result = [ lambda x: "%s%s\n"%(data,"".ljust(4096," ")), lambda x: "Event: %s\ndata:%s\n\n"%(cometName,data), lambda x: "\n"%(data) ][int(cometType)-1]("") return result def getContentType(cometType): "Returns correct content type by cometType" result = [ lambda x: "text/html", lambda x: "application/x-dom-event-stream", lambda x: "text/html" ][int(cometType)-1]("") return result