diff tincan.py @ 44:7261459351fa draft

More multithread support, remove debug writes.
author David Barts <n5jrn@me.com>
date Thu, 30 May 2019 11:23:26 -0700
parents 0bd9b9ae9998
children 969f515b505b
line wrap: on
line diff
--- a/tincan.py	Thu May 30 08:59:35 2019 -0700
+++ b/tincan.py	Thu May 30 11:23:26 2019 -0700
@@ -437,7 +437,7 @@
             self._encoding = None
 
     def launch(self):
-        print("adding static route:", self._urlpath)  # debug
+        # print("adding static route:", self._urlpath)  # debug
         self._app.route(self._urlpath, 'GET', self)
 
     def _parse_date(self, ims):
@@ -619,7 +619,7 @@
             if not methods:
                 raise TinCanError("{0}: no #methods specified".format(self._urlpath))
         # Register this thing with Bottle
-        print("adding route:", self._origin, '('+','.join(methods)+')')  # debug
+        # print("adding route:", self._origin, '('+','.join(methods)+')')  # debug
         self._app.route(self._origin, methods, self)
 
     def _splitpath(self, unsplit):
@@ -886,14 +886,15 @@
     sys.stderr.write(message)
     sys.stderr.write('\n')
 
-def launch(fsroot=None, urlroot='/', logger=_logger, debug=False, encoding=ENCODING, static=False):
+def launch(fsroot=None, urlroot='/', logger=_logger, debug=False,
+    encoding=ENCODING, static=False, multithread=True):
     """
     Launch and return a TinCan webapp. Does not run the app; it is the
     caller's responsibility to call app.run()
     """
     if fsroot is None:
         fsroot = os.getcwd()
-    launcher = _Launcher(fsroot, urlroot, logger)
+    launcher = _Launcher(fsroot, urlroot, logger, multithread=multithread)
     launcher.debug = debug
     launcher.encoding = encoding
     launcher.static = static