Cheetah.Utils.Misc module¶
Miscellaneous functions/objects used by Cheetah but also useful standalone.
-
Cheetah.Utils.Misc.
checkKeywords
(dic, legalKeywords, what='argument')¶ Verify no illegal keyword arguments were passed to a function.
- in : dic, dictionary (**kw in the calling routine).
- legalKeywords, list of strings, the keywords that are allowed. what, string, suffix for error message (see function source).
out: None. exc: TypeError if ‘dic’ contains a key not in ‘legalKeywords’. called by: Cheetah.Template.__init__()
-
Cheetah.Utils.Misc.
die
(reason)¶
-
Cheetah.Utils.Misc.
mkdirsWithPyInitFiles
(path)¶ Same as os.makedirs (mkdir ‘path’ and all missing parent directories) but also puts a Python ‘__init__.py’ file in every directory it creates. Does nothing (without creating an ‘__init__.py’ file) if the directory already exists.
-
Cheetah.Utils.Misc.
removeFromList
(list_, *elements)¶ Save as list_.remove(each element) but don’t raise an error if element is missing. Modifies ‘list_’ in place! Returns None.
-
Cheetah.Utils.Misc.
useOrRaise
(thing, errmsg='')¶ Raise ‘thing’ if it’s a subclass of Exception. Otherwise return it.
Called by: Cheetah.Servlet.cgiImport()