clone 584781 -1
reassign -1 python-paste
retitle -1 please provide a way to run in "quiet mode", with no output in stdout
thanks

Ciao Enrico,

On Sun, 06 Jun 2010 15:17:54 +0100, Enrico Zini wrote:

> I'd like to run a bottle server without it spewing messages to
> stdout/stderr. For that, I need to turn off the welcome code here:
> 
>    def run(app=None, server=AutoServer, host='127.0.0.1', port=8080,
>            interval=1, reloader=False, **kargs):
>        """ Runs bottle as a web server. """
>        app = app if app else default_app()
>        quiet = bool(kargs.get('quiet', False))
>        # Instantiate server, if it is a class instead of an instance
>        if isinstance(server, type):
>            server = server(host=host, port=port, **kargs)
>        if not isinstance(server, ServerAdapter):
>            raise RuntimeError("Server must be a subclass of WSGIAdapter")
>        if not quiet and isinstance(server, ServerAdapter): # pragma: no cover
>            if not reloader or os.environ.get('BOTTLE_CHILD') == 'true':
>                print "Bottle server starting up (using %s)..." % repr(server)
>                print "Listening on http://%s:%d/"; % (server.host, server.port)
>                print "Use Ctrl-C to quit."
>                print
>            else:
>                print "Bottle auto reloader starting up..."
>        try:
>            if reloader and interval:
>                reloader_run(server, app, interval)
>            else:
>                server.run(app)
>        except KeyboardInterrupt:
>            if not quiet: # pragma: no cover
>                print "Shutting Down..."
> 
> Note that in order to do it, one just needs to pass quiet=True. Great.
> Except, it uses kargs.get instead of kargs.pop, therefore leaving quiet
> in the args that are passed to the server constructor 3 lines later.

Ok, fixed it, thanks!

> [..]
> And yet, it's not enough:
> 
>     $ ./arki-server ../data/conf  --quiet
>     serving on http://127.0.0.1:8080
> 
> There is no way whatsoever to tell paste's httpserver to shut up. It
> just damn prints. From /usr/share/pyshared/paste/httpserver.py:
> 
>     if converters.asbool(start_loop):
>         protocol = is_ssl and 'https' or 'http'
>         host, port = server.server_address
>         if host == '0.0.0.0':
>             print 'serving on 0.0.0.0:%s view at %s://127.0.0.1:%s' % \
>                 (port, protocol, port)
>         else:
>             print "serving on %s://%s:%s" % (protocol, host, port)
>         try:
>             server.serve_forever()
>         except KeyboardInterrupt:
>             # allow CTRL+C to shutdown
>             pass
> 
> I'll now quietly go in a corner to sob and pull all my hair out one by
> one.

I'm cloning the bug, mangling it appropriately and reassigning it to
python-paste.

Kindly,
David

-- 
 . ''`.   Debian developer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://deb.li/dapal
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174

Attachment: signature.asc
Description: PGP signature

Reply via email to