##// END OF EJS Templates
Made open_in_browser configurable.
damianavila -
Show More
@@ -19,7 +19,7 b' import webbrowser'
19 19 from BaseHTTPServer import HTTPServer
20 20 from SimpleHTTPServer import SimpleHTTPRequestHandler
21 21
22 from IPython.utils.traitlets import Unicode
22 from IPython.utils.traitlets import Unicode, Bool
23 23
24 24 from .base import PostProcessorBase
25 25
@@ -34,6 +34,10 b' class ServePostProcessor(PostProcessorBase):'
34 34 help="""Directory to write output to. Leave blank
35 35 to output to the current directory""")
36 36
37 open_in_browser = Bool(True, config=True,
38 help="""Set to False to deactivate
39 the opening of the browser""")
40
37 41 def call(self, input):
38 42 """
39 43 Simple implementation to serve the build directory.
@@ -45,6 +49,7 b' class ServePostProcessor(PostProcessorBase):'
45 49 sa = httpd.socket.getsockname()
46 50 name = input[2:]
47 51 url = "http://" + sa[0] + ":" + str(sa[1]) + "/" + name
52 if self.open_in_browser:
48 53 webbrowser.open(url, new=2)
49 54 print("Serving " + name + " on " + url)
50 55 print("Use Control-C to stop this server.")
General Comments 0
You need to be logged in to leave comments. Login now