# HG changeset patch # User David Barts # Date 1558479713 25200 # Node ID f6a1492fe56e6aaf026ee56e5d8e5b2503fba4c6 # Parent ca2029ce95c7af78543a60a1553cc302d864e739 Template loading (includes) pass all tests. diff -r ca2029ce95c7 -r f6a1492fe56e tincan.py --- a/tincan.py Tue May 21 15:57:15 2019 -0700 +++ b/tincan.py Tue May 21 16:01:53 2019 -0700 @@ -210,7 +210,7 @@ self.expression_types['load'] = \ _LoaderFactory(base, subdir, encoding) self.expression_types['lload'] = \ - _LoaderFactory(os.path.join(base,_WINF,"tlib"), None, encoding) + _LoaderFactory(os.path.join(base,_WINF,"tlib"), [], encoding) class _LoaderFactory(object): """ @@ -235,14 +235,11 @@ self.params = based_on def __call__(self, target, engine): - if self.params.subdir is None: - npath = os.path.join(self.params.base, self.path.lstrip('/')) - else: - try: - normalized = _normpath(self.params.subdir, self.path) - except IndexError: - raise ValueError("invalid path: {0!s}".format(self.path)) - npath = os.path.join(self.params.base, *normalized) + try: + normalized = _normpath(self.params.subdir, self.path) + except IndexError: + raise ValueError("invalid path: {0!s}".format(self.path)) + npath = os.path.join(self.params.base, *normalized) with open(npath, "r", encoding=self.params.encoding) as fp: contents = fp.read() value = ast.Str(contents)