Commits

Ned Batchelder committed 8b9c7e5

Make it easier to debug the code.

  • Participants
  • Parent commits 84fac5c

Comments (0)

Files changed (1)

 
 PAGE_DATA = {
     'version': __version__,
+    'poll_interval': 500,
     }
 
 THE_PAGE = """\
 var harvest = {
     state: "zero",  // working, quit, died
     polls: 0,
-    poll_interval: 500,
+    poll_interval: %(poll_interval)s,
     dot: "• ",
     dots: "",
 
 
         var username = $("#username").val();
         var password = $("#password").val();
+        var original = $("#original").is(":checked") ? 1 : 0;
 
         if (!username || !password) {
             alert("Please enter a username and password to start.");
             data: {
                 username: username,
                 password: password,
-                original: $("#original").is(":checked") ? 1 : 0
+                original: original
             },
         });
     },
     </div>
 </div>
 </html>
-""" % PAGE_DATA
+"""
 
 DUPLICATE_PAGE = """\
 <!DOCTYPE html>
     </div>
 </div>
 </html>
-""" % PAGE_DATA
+"""
 
 @b.route('/')
 def home():
-    return THE_PAGE
+    return THE_PAGE % PAGE_DATA
 
 @b.route('/other')
 def other():
-    return DUPLICATE_PAGE
+    return DUPLICATE_PAGE % PAGE_DATA
 
 @b.route('/quit')
 def quit():
             self.delay = self.andthen
 
 def main(host, port):
+    debug = ("debug" in sys.argv)
+    if debug:
+        PAGE_DATA['poll_interval'] = 9999999
+
     url = "http://%s:%d/" % (host, port)
     # Try to talk to the server to see if one is already running.
     try:
         # Instantiate the server before calling webbrowser.open() to avoid a race.
         server = EarlyBindWSGIRefServer(host=host, port=port)
         webbrowser.open(url)
-        PoisonPillThread(30, 5).start()
+        if not debug:
+            PoisonPillThread(30, 5).start()
         b.run(server=server, quiet=True)