Sunday, 26. February 2006 13:31.
New function lino.misc.etc.ispure() tests whether a string is «pure»: either pure ASCII or Unicode, but not a simple string with non-ascii characters
def ispure(s): if s is None: return True if type(s) == types.UnicodeType: return True if type(s) == types.StringType: try: s.decode('ascii') except UnicodeDecodeError,e: return False return True return False
This is used at different places.
Refering articles:
- Some tests still failing (code changes 26.02.06) — Tests 20 and 42 fail. more