comparison tincan.py @ 54:cb5a6e200c95 draft

Detect bad args, too.
author David Barts <n5jrn@me.com>
date Fri, 31 May 2019 08:45:39 -0700
parents 3a6180c1feea
children 8e72dd62cc6a
comparison
equal deleted inserted replaced
53:3a6180c1feea 54:cb5a6e200c95
890 caller's responsibility to call app.run() 890 caller's responsibility to call app.run()
891 """ 891 """
892 if fsroot is None: 892 if fsroot is None:
893 fsroot = os.getcwd() 893 fsroot = os.getcwd()
894 launcher = _Launcher(fsroot, urlroot, multithread) 894 launcher = _Launcher(fsroot, urlroot, multithread)
895 for i in [ "logger", "encoding", "static" ]: 895 allowed = set(["logger", "encoding", "static"])
896 if i in kwargs: 896 for k, v in kwargs.items():
897 setattr(launcher, i, kwargs[i]) 897 if k not in allowed:
898 raise TypeError("launch() got an unexpected keyword argument {0!r}".format(k))
899 setattr(launcher, k, v)
898 launcher.launch() 900 launcher.launch()
899 return launcher.app, launcher.errors 901 return launcher.app, launcher.errors
900 902
901 # XXX - We cannot implement a command-line launcher here; see the 903 # XXX - We cannot implement a command-line launcher here; see the
902 # launcher script for why. 904 # launcher script for why.