On May 25, 10:46 am, Pascal Chambon <chambon.pas...@wanadoo.fr> wrote:
> * code safety : it seems default python string formatting technics (% > operator, .format() method) are normally used when one needs to > substitute placeholders in translated strings. But the thing is : I DONT > want my view to raise an exception simply because one of the > translations has forgotten a damn "%(myvar)s" placeholder. The only > quick fix I can think of, is to always use substitution through > defaultdicts instances (and still, exceptions could occur if abnormal > "%s" placeholders are found in the translated string). > Are there some utilities in python, or frameworks like django, > to allow a safe string substitution (which might, > for example, simply log an error if a buggy string si found) ? Python's > template strings' "safe_substitute()" won't fit, because it swallows > errors without any notice... For this one, you might check into pylint. I've just recently started using it, but I'm loving it. I pretty much don't check things in without first running them through pylint (and some unit tests) first now. -- http://mail.python.org/mailman/listinfo/python-list