[Lxml-checkins] r33758 - in lxml/trunk: . src/lxml
scoder at codespeak.net
scoder at codespeak.net
Thu Oct 26 13:34:47 CEST 2006
Author: scoder
Date: Thu Oct 26 13:34:44 2006
New Revision: 33758
Modified:
lxml/trunk/MANIFEST.in
lxml/trunk/src/lxml/objectify.pyx
Log:
include Pyrex sources in distro
Modified: lxml/trunk/MANIFEST.in
==============================================================================
--- lxml/trunk/MANIFEST.in (original)
+++ lxml/trunk/MANIFEST.in Thu Oct 26 13:34:44 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/Pyrex *.py
+recursive-include 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:34:44 2006
@@ -1,7 +1,8 @@
from etreepublic cimport _Document, _Element, ElementBase
from etreepublic cimport _ElementIterator, ElementClassLookup
from etreepublic cimport elementFactory, import_etree, textOf
-from python cimport isinstance, issubclass, callable, getattr, _cstr, Py_ssize_t
+from python cimport str, repr, isinstance, issubclass, callable, getattr
+from python cimport _cstr, Py_ssize_t
cimport etreepublic as cetree
cimport python
cimport tree
@@ -27,8 +28,6 @@
float = __builtin__.float
cdef object bool
bool = __builtin__.bool
-cdef object str
-str = __builtin__.str
cdef object pow
pow = __builtin__.pow
cdef object abs
@@ -516,7 +515,7 @@
return float(textOf(self._c_node))
def __str__(self):
- return str(self._type(textOf(self._c_node)))
+ return repr(self._type(textOf(self._c_node)))
# def __oct__(self):
# def __hex__(self):
@@ -931,13 +930,18 @@
cdef object _dump(_Element element, int indent):
indentstr = " " * indent
- if hasattr(element, "pyval"):
- value = element.pyval
+ if isinstance(element, StringElement):
+ value = repr(textOf(element._c_node))
+ elif isinstance(element, ObjectifiedDataElement):
+ value = str(element)
else:
value = textOf(element._c_node)
- if value and not value.strip():
- value = None
- result = "%s%s = %r [%s]\n" % (indentstr, element.tag,
+ 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,
value, type(element).__name__)
xsi_ns = "{%s}" % XML_SCHEMA_INSTANCE_NS
pytype_ns = "{%s}" % PYTYPE_NAMESPACE
More information about the lxml-checkins
mailing list