From f8ef7884c2d73534989d9e050c8231b4eed56555 Mon Sep 17 00:00:00 2001 From: Marcel Hellkamp Date: Sat, 19 Nov 2011 20:37:47 +0100 Subject: Code cleanup. --- bottle.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/bottle.py b/bottle.py index dd335f9..9b9f2e0 100755 --- a/bottle.py +++ b/bottle.py @@ -2882,22 +2882,23 @@ ext = _ImportRedirect(__name__+'.ext', 'bottle_%s').module if __name__ == '__main__': opt, args, parser = _cmd_options, _cmd_args, _cmd_parser if opt.version: - print 'Bottle', __version__; sys.exit(0) + print 'Bottle', __version__ + sys.exit(0) if not args: parser.error('No application specified.') - try: - sys.path.insert(0, '.') - sys.modules.setdefault('bottle', sys.modules['__main__']) - except (AttributeError, ImportError), e: - parser.error(e.args[0]) + debug(opt.debug) + sys.path.insert(0, '.') + sys.modules.setdefault('bottle', sys.modules['__main__']) + + host, port = (opt.bind or 'localhost'), 8080 + if ':' in host: + host, port = host.rsplit(':', 1) + + run(args[0], host=host, port=port, server=opt.server, + reloader=opt.reload, plugins=opt.plugin) + - if opt.bind and ':' in opt.bind: - host, port = opt.bind.rsplit(':', 1) - else: - host, port = (opt.bind or 'localhost'), 8080 - debug(opt.debug) - run(args[0], host=host, port=port, server=opt.server, reloader=opt.reload, plugins=opt.plugin) # THE END -- cgit v1.2.1