Small patch from Steven Taschuk to work around buggy dbm
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 22 May 2006 12:09:48 +0000 (12:09 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 22 May 2006 12:09:48 +0000 (12:09 +0000)
implementations which have non-idempotent len() functions, so that
the test `if db' doesn't return the same result every time (!). By
explicitly testing whether db is None rather than returning false if
db is non-None but inexplicably returns zero from len(), we avoid
the problem in favour of the semantics I actually intended.

git-svn-id: svn://svn.tartarus.org/sgt/utils@6715 cda61777-01e9-0310-a592-d414129be87e

cvt-utf8/cvt-utf8

index c7c4d20..4df2f33 100755 (executable)
@@ -62,7 +62,7 @@ def hexstr(x):
     return s
 
 def charname(x):
-    if db:
+    if db is not None:
        key = hexstr(x)
        while len(key) < 4: key = "0" + key
        key = string.upper(key)