Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
def main():
    
    Experiment.initLogging(os.environ.has_key("GATEWAY_INTERFACE"))
    
    (odict, args) = getOptions()
    (odict, args) = processOptions(odict, args)
        
    data = doit(odict, odict["e"])
Esempio n. 4
0
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
Esempio n. 5
0
def main():
    
    Experiment.initLogging()
    odict, args = getOptions()
    doAmazing(odict, args)
Esempio n. 6
0
def main():

    Experiment.initLogging()
    (odict, args) = getOptions()
    g = SourceGenerator(odict)
    g.generateSources()
Esempio n. 7
0
def main():
    
    Experiment.initLogging()
    (odict, args) = getOptions()
    eg = ExampleGenerator(odict, args)
    eg.generateExamples()