def main(): try: Experiment.initLogging(os.environ.has_key("GATEWAY_INTERFACE")) if os.environ.has_key("GATEWAY_INTERFACE"): # CGI (odict, args) = getCGIOptions() else: # Command line. All the output is still CGI-ish, though. Sorry. (odict, args) = getOptions() (odict, args) = processOptions(odict, args) if odict.has_key("e") or not odict.has_key("c"): data = getGallery(odict, odict.get("e"), odict.get("c")) else: data = getPage(odict, odict["c"], odict.get("p"), odict.get("n")) print "Content-type: text/html" print "Content-length: %s" % (len(data)) print print data except: msg = string.join(apply( traceback.format_exception, sys.exc_info() ), "") if (msg[-1] == "\n"): msg = msg[:-1] logging.getLogger().warning(msg) data = "Huh?\n%s" % (msg) print "Status: 500 Internal Server Error" print "Content-type: text/plain" print "Content-length: %s" % (len(data)) print print data
def main(): try: Experiment.initLogging(os.environ.has_key("GATEWAY_INTERFACE")) if os.environ.has_key("GATEWAY_INTERFACE"): # CGI (odict, args) = getCGIOptions() else: # Command line. All the output is still CGI-ish, though. Sorry. (odict, args) = getOptions() (odict, args) = processOptions(odict, args) data = newCreature(odict, odict["e"], odict.get("p")) data = Location.getJsonModule().dumps(data, indent=2) print "Content-type: application/json" print "Content-length: %s" % (len(data)) print print data except: msg = string.join(apply( traceback.format_exception, sys.exc_info() ), "") if (msg[-1] == "\n"): msg = msg[:-1] logging.getLogger().warning(msg) data = "Huh?\n%s" % (msg) print "Status: 500 Internal Server Error" print "Content-type: text/plain" print "Content-length: %s" % (len(data)) print print data
def main(): Experiment.initLogging(os.environ.has_key("GATEWAY_INTERFACE")) (odict, args) = getOptions() (odict, args) = processOptions(odict, args) data = doit(odict, odict["e"])
def main(): try: Experiment.initLogging(False) # Command line. All the output is still CGI-ish, though. Sorry. (odict, args) = getOptions() (odict, args) = processOptions(odict, args) if args: exp = newExperiment(odict, args[0]) else: exp = newExperiment(odict) creature = newCreature(odict, exp) tweet(odict, creature) except: msg = string.join(apply( traceback.format_exception, sys.exc_info() ), "") if (msg[-1] == "\n"): msg = msg[:-1] logging.getLogger().warning(msg) data = "Huh?\n%s" % (msg) print data
def main(): Experiment.initLogging() odict, args = getOptions() doAmazing(odict, args)
def main(): Experiment.initLogging() (odict, args) = getOptions() g = SourceGenerator(odict) g.generateSources()
def main(): Experiment.initLogging() (odict, args) = getOptions() eg = ExampleGenerator(odict, args) eg.generateExamples()