CheetahWrapper.py (cheetah3-3.1.0) | : | CheetahWrapper.py (cheetah3-3.2.0) | ||
---|---|---|---|---|
skipping to change at line 453 | skipping to change at line 453 | |||
if recurse: | if recurse: | |||
for root, dirs, _files in os.walk(path): | for root, dirs, _files in os.walk(path): | |||
for _f in _files: | for _f in _files: | |||
_path = os.path.join(root, _f) | _path = os.path.join(root, _f) | |||
if _path.endswith(iext) and os.path.isfile(_path): | if _path.endswith(iext) and os.path.isfile(_path): | |||
files.append(_path) | files.append(_path) | |||
else: | else: | |||
raise Error("source file '%s' is a directory" % path) | raise Error("source file '%s' is a directory" % path) | |||
elif os.path.isfile(path): | elif os.path.isfile(path): | |||
files.append(path) | files.append(path) | |||
elif (addIextIfMissing and not path.endswith(iext) and | elif (addIextIfMissing and not path.endswith(iext) | |||
os.path.isfile(pathWithExt)): | and os.path.isfile(pathWithExt)): | |||
files.append(pathWithExt) | files.append(pathWithExt) | |||
# Do not recurse directories discovered by iext appending. | # Do not recurse directories discovered by iext appending. | |||
elif os.path.exists(path): | elif os.path.exists(path): | |||
W("Skipping source file '%s', not a plain file.", path) | W("Skipping source file '%s', not a plain file.", path) | |||
else: | else: | |||
W("Skipping source file '%s', not found.", path) | W("Skipping source file '%s', not found.", path) | |||
if len(files) > oldFilesLen: | if len(files) > oldFilesLen: | |||
D(" ... found %s", files[oldFilesLen:]) | D(" ... found %s", files[oldFilesLen:]) | |||
return files | return files | |||
skipping to change at line 527 | skipping to change at line 527 | |||
self.error('The value of option --templateAPIClass is invalid\n' | self.error('The value of option --templateAPIClass is invalid\n' | |||
'It must be in the form "module:class", ' | 'It must be in the form "module:class", ' | |||
'e.g. "Cheetah.Template:Template"') | 'e.g. "Cheetah.Template:Template"') | |||
modname, classname = modname.split(':') | modname, classname = modname.split(':') | |||
C('using --templateAPIClass=%s:%s' % (modname, classname)) | C('using --templateAPIClass=%s:%s' % (modname, classname)) | |||
if p >= 0: | if p >= 0: | |||
mod = getattr( | mod = getattr( | |||
__import__(modname[:p], {}, {}, [modname[p+1:]]), | __import__(modname[:p], {}, {}, [modname[p+1:]]), # noqa: E226, | |||
modname[p+1:]) | E501 missing whitespace around operator | |||
modname[p+1:]) # noqa: E226 missing whitespace around operator | ||||
else: | else: | |||
mod = __import__(modname, {}, {}, []) | mod = __import__(modname, {}, {}, []) | |||
klass = getattr(mod, classname, None) | klass = getattr(mod, classname, None) | |||
if klass: | if klass: | |||
self._templateClass = klass | self._templateClass = klass | |||
return klass | return klass | |||
else: | else: | |||
self.error('**Template class specified ' | self.error('**Template class specified ' | |||
'in option --templateAPIClass not found\n' | 'in option --templateAPIClass not found\n' | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added |