[Lxml-checkins] r54760 - in lxml/trunk: . src/lxml

scoder at codespeak.net scoder at codespeak.net
Thu May 15 20:08:49 CEST 2008


Author: scoder
Date: Thu May 15 20:08:46 2008
New Revision: 54760

Modified:
   lxml/trunk/   (props changed)
   lxml/trunk/src/lxml/apihelpers.pxi
Log:
 r4216 at delle:  sbehnel | 2008-05-14 18:14:49 +0200
 better error message


Modified: lxml/trunk/src/lxml/apihelpers.pxi
==============================================================================
--- lxml/trunk/src/lxml/apihelpers.pxi	(original)
+++ lxml/trunk/src/lxml/apihelpers.pxi	Thu May 15 20:08:46 2008
@@ -1020,13 +1020,13 @@
 
 cdef object _utf8(object s):
     if python.PyString_Check(s):
-        assert not isutf8py(s), \
-               "All strings must be XML compatible, either Unicode or ASCII"
+        assert isutf8py(s) == 0, \
+            "All strings must be XML compatible: Unicode or ASCII, no NULL bytes"
     elif python.PyUnicode_Check(s):
         # FIXME: we should test these strings, too ...
         s = python.PyUnicode_AsUTF8String(s)
         assert isutf8py(s) != -1, \
-               "All strings must be XML compatible, either Unicode or ASCII"
+            "All strings must be XML compatible: Unicode or ASCII, no NULL bytes"
     else:
         raise TypeError, "Argument must be string or unicode."
     return s


More information about the lxml-checkins mailing list