# HG changeset patch # User David Barts # Date 1563140853 25200 # Node ID b5e72129ef72a6f15c30970d4ffb73ada4a86f82 # Parent f33cb3e934735239c7e73f856db0ff676c922f39 Support #errors w/ no params, as documented. diff -r f33cb3e93473 -r b5e72129ef72 tincan.py --- a/tincan.py Fri Jul 12 20:27:52 2019 -0700 +++ b/tincan.py Sun Jul 14 14:47:33 2019 -0700 @@ -135,6 +135,7 @@ _NAMES = [ "errors", "forward", "methods", "python", "template" ] _FNAMES = [ "hidden" ] _ANAMES = [ "load" ] + _ONAMES = [ "errors" ] def __init__(self, string): # Initialize our state @@ -179,7 +180,10 @@ continue # Get parameter if rpa is None: - raise TemplateHeaderError("Missing parameter.", count) + if name in self._ONAMES: + rpa = "" + else: + raise TemplateHeaderError("Missing parameter.", count) param = rpa.strip() for i in [ "'", '"']: if param.startswith(i) and param.endswith(i): @@ -585,7 +589,7 @@ # self.logger.debug("forwarded to: %s", self._urlpath) # debug # If this is a #hidden page, we ignore it for now, since hidden pages # don't get routes made for them. - if oheader.hidden and not oheader.errors: + if oheader.hidden and oheader.errors is None: return # Get the code-behind #python if self._header.python is None: @@ -687,7 +691,7 @@ pypath = os.path.normpath(os.path.join(self._fsroot, *self._splitpath(self._python))) except IndexError as e: raise TinCanError("{0}: invalid #python".format(self._urlpath)) from e - klass = ErrorPage if self._header.errors else Page + klass = ErrorPage if self._header.errors is not None else Page # Give 'em a default code-behind if they don't furnish one pytime = self._gettime(pypath) if not pytime: