Mercurial > cgi-bin > hgweb.cgi > tincan
changeset 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 |
files | tincan.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tincan.py Fri May 31 08:23:37 2019 -0700 +++ b/tincan.py Fri May 31 08:45:39 2019 -0700 @@ -892,9 +892,11 @@ if fsroot is None: fsroot = os.getcwd() launcher = _Launcher(fsroot, urlroot, multithread) - for i in [ "logger", "encoding", "static" ]: - if i in kwargs: - setattr(launcher, i, kwargs[i]) + allowed = set(["logger", "encoding", "static"]) + for k, v in kwargs.items(): + if k not in allowed: + raise TypeError("launch() got an unexpected keyword argument {0!r}".format(k)) + setattr(launcher, k, v) launcher.launch() return launcher.app, launcher.errors