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

scoder at codespeak.net scoder at codespeak.net
Thu Oct 26 13:36:15 CEST 2006


Author: scoder
Date: Thu Oct 26 13:36:13 2006
New Revision: 33759

Modified:
   lxml/trunk/MANIFEST.in
   lxml/trunk/src/lxml/objectify.pyx
Log:
reverted last commit

Modified: lxml/trunk/MANIFEST.in
==============================================================================
--- lxml/trunk/MANIFEST.in	(original)
+++ lxml/trunk/MANIFEST.in	Thu Oct 26 13:36:13 2006
@@ -8,6 +8,6 @@
 recursive-include src/lxml/tests *.rng *.xslt *.xml *.dtd
 recursive-include benchmark *.py
 recursive-include doc *.txt *.html *.css *.xml *.mgp pubkey.asc
-recursive-include Pyrex *.py
+recursive-include pyrex/Pyrex *.py
 include doc/mkhtml.py doc/rest2html.py
 exclude doc/pyrex.txt src/lxml/etree.pxi

Modified: lxml/trunk/src/lxml/objectify.pyx
==============================================================================
--- lxml/trunk/src/lxml/objectify.pyx	(original)
+++ lxml/trunk/src/lxml/objectify.pyx	Thu Oct 26 13:36:13 2006
@@ -1,8 +1,7 @@
 from etreepublic cimport _Document, _Element, ElementBase
 from etreepublic cimport _ElementIterator, ElementClassLookup
 from etreepublic cimport elementFactory, import_etree, textOf
-from python cimport str, repr, isinstance, issubclass, callable, getattr
-from python cimport _cstr, Py_ssize_t
+from python cimport isinstance, issubclass, callable, getattr, _cstr, Py_ssize_t
 cimport etreepublic as cetree
 cimport python
 cimport tree
@@ -28,6 +27,8 @@
 float = __builtin__.float
 cdef object bool
 bool = __builtin__.bool
+cdef object str
+str = __builtin__.str
 cdef object pow
 pow = __builtin__.pow
 cdef object abs
@@ -515,7 +516,7 @@
         return float(textOf(self._c_node))
 
     def __str__(self):
-        return repr(self._type(textOf(self._c_node)))
+        return str(self._type(textOf(self._c_node)))
 
 #    def __oct__(self):
 #    def __hex__(self):
@@ -930,18 +931,13 @@
 
 cdef object _dump(_Element element, int indent):
     indentstr = "    " * indent
-    if isinstance(element, StringElement):
-        value = repr(textOf(element._c_node))
-    elif isinstance(element, ObjectifiedDataElement):
-        value = str(element)
+    if hasattr(element, "pyval"):
+        value = element.pyval
     else:
         value = textOf(element._c_node)
-        if value is not None:
-            if python.PyString_GET_SIZE( value.strip() ) == 0:
-                value = None
-            else:
-                value = repr(value)
-    result = "%s%s = %s [%s]\n" % (indentstr, element.tag,
+        if value and not value.strip():
+            value = None
+    result = "%s%s = %r [%s]\n" % (indentstr, element.tag,
                                    value, type(element).__name__)
     xsi_ns    = "{%s}" % XML_SCHEMA_INSTANCE_NS
     pytype_ns = "{%s}" % PYTYPE_NAMESPACE


More information about the lxml-checkins mailing list