Ticket #1713: toolbox-no-ipv6-default.diff
| File toolbox-no-ipv6-default.diff, 2.9 kB (added by Chris Arndt, 5 months ago) |
|---|
-
turbogears/command/base.py
old new 241 241 desc = "Launch the TurboGears Toolbox" 242 242 243 243 def __init__(self, version): 244 self.hostlist = ['127.0.0.1', '::1']244 self.hostlist = ['127.0.0.1', '::1', '::ffff:127.0.0.1'] 245 245 246 parser = optparse.OptionParser( 247 usage="%prog toolbox [options]", version="%prog " + version)246 parser = optparse.OptionParser(usage="%prog toolbox [options]", 247 version="%prog " + version, description=self.desc) 248 248 parser.add_option("-n", "--no-open", 249 help="don't open browser automatically",250 dest="noopen", action="store_true",251 default=False)249 help="don't open browser automatically", 250 dest="noopen", action="store_true", 251 default=False) 252 252 parser.add_option("-c", "--add-client", 253 help="allow the client ip address specified to connect to toolbox (Can be specified more than once)", 254 dest="host", action="append", default=None) 253 help="allow the client ip address specified to connect to toolbox (Can be specified more than once)", 254 dest="clients", metavar="ADDR", action="append", default=None) 255 parser.add_option("-s", "--server-address", 256 help="interface address to run the Toolbox on (default: 0.0.0.0)", 257 dest="host", metavar="ADDR", default='0.0.0.0') 255 258 parser.add_option("-p", "--port", 256 help="port to run the Toolbox on", dest="port", default=7654)259 help="port to run the Toolbox on", dest="port", default=7654) 257 260 parser.add_option("--conf", help="config file to use", 258 dest="config", default=get_project_config())261 dest="config", default=get_project_config()) 259 262 260 263 (options, args) = parser.parse_args(sys.argv[1:]) 264 self.host = options.host 261 265 self.port = int(options.port) 262 266 self.noopen = options.noopen 263 267 self.config = options.config 264 268 265 if options. host:266 self.hostlist = self.hostlist + options. host269 if options.clients: 270 self.hostlist = self.hostlist + options.clients 267 271 268 272 turbogears.widgets.load_widgets() 269 273 270 274 def openbrowser(self): 271 275 import webbrowser 272 webbrowser.open("http:// localhost:%d" % self.port)276 webbrowser.open("http://%s:%d" % (self.host, self.port)) 273 277 274 278 def run(self): 275 279 import cherrypy … … 293 297 # amend some parameters since we are running from the command 294 298 # line in order to change port, log methods... 295 299 config.update({"global" : { 300 "server.socket_host" : self.host, 296 301 "server.socket_port" : self.port, 297 302 "server.environment" : "development", 298 303 "server.log_to_screen" : True,