[Lxml-checkins] r39484 - in lxml/branch/lxml-1.2: . doc src/lxml src/lxml/tests
scoder at codespeak.net
scoder at codespeak.net
Tue Feb 27 10:24:41 CET 2007
Author: scoder
Date: Tue Feb 27 10:24:39 2007
New Revision: 39484
Modified:
lxml/branch/lxml-1.2/CHANGES.txt
lxml/branch/lxml-1.2/Makefile
lxml/branch/lxml-1.2/TODO.txt
lxml/branch/lxml-1.2/doc/main.txt
lxml/branch/lxml-1.2/setupinfo.py
lxml/branch/lxml-1.2/src/lxml/ElementInclude.py
lxml/branch/lxml-1.2/src/lxml/etree_defs.h
lxml/branch/lxml-1.2/src/lxml/objectify.pyx
lxml/branch/lxml-1.2/src/lxml/parser.pxi
lxml/branch/lxml-1.2/src/lxml/sax.py
lxml/branch/lxml-1.2/src/lxml/tests/test_objectify.py
Log:
merged in updates and bug fixes from trunk
Modified: lxml/branch/lxml-1.2/CHANGES.txt
==============================================================================
--- lxml/branch/lxml-1.2/CHANGES.txt (original)
+++ lxml/branch/lxml-1.2/CHANGES.txt Tue Feb 27 10:24:39 2007
@@ -2,6 +2,24 @@
lxml changelog
==============
+1.2.1 (2007-02-27)
+==================
+
+Features added
+--------------
+
+
+Bugs fixed
+----------
+
+* Item assignments to special names like ``element["text"]`` failed
+
+* Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier
+ to access
+
+* The pattern for attribute names in ObjectPath was too restrictive
+
+
1.2 (2007-02-20)
================
Modified: lxml/branch/lxml-1.2/Makefile
==============================================================================
--- lxml/branch/lxml-1.2/Makefile (original)
+++ lxml/branch/lxml-1.2/Makefile Tue Feb 27 10:24:39 2007
@@ -22,7 +22,7 @@
valgrind_test_inplace: inplace
valgrind --tool=memcheck --leak-check=full --suppressions=valgrind-python.supp \
- $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
+ $(PYTHON) test.py
bench_inplace: inplace
$(PYTHON) bench.py -i
Modified: lxml/branch/lxml-1.2/TODO.txt
==============================================================================
--- lxml/branch/lxml-1.2/TODO.txt (original)
+++ lxml/branch/lxml-1.2/TODO.txt Tue Feb 27 10:24:39 2007
@@ -16,6 +16,8 @@
* more testing on multi-threading
+* the code on extension functions and XSLT needs some refactoring
+
ElementTree
-----------
Modified: lxml/branch/lxml-1.2/doc/main.txt
==============================================================================
--- lxml/branch/lxml-1.2/doc/main.txt (original)
+++ lxml/branch/lxml-1.2/doc/main.txt Tue Feb 27 10:24:39 2007
@@ -29,6 +29,8 @@
.. _`installation instructions`: installation.html
+* `lxml 1.2.1`_, released 2007-02-20 (`changes for 1.2.1`_)
+
* `lxml 1.2`_, released 2007-02-20 (`changes for 1.2`_)
* `lxml 1.1.2`_, released 2006-10-30 (`changes for 1.1.2`_)
@@ -63,6 +65,7 @@
* `lxml 0.5`_, released 2005-04-08
+.. _`lxml 1.2.1`: lxml-1.2.1.tgz
.. _`lxml 1.2`: lxml-1.2.tgz
.. _`lxml 1.1.2`: lxml-1.1.2.tgz
.. _`lxml 1.1.1`: lxml-1.1.1.tgz
@@ -81,6 +84,7 @@
.. _`lxml 0.5.1`: lxml-0.5.1.tgz
.. _`lxml 0.5`: lxml-0.5.tgz
+.. _`CHANGES for 1.2.1`: changes-1.2.1.html
.. _`CHANGES for 1.2`: changes-1.2.html
.. _`CHANGES for 1.1.2`: changes-1.1.2.html
.. _`CHANGES for 1.1.1`: changes-1.1.1.html
Modified: lxml/branch/lxml-1.2/setupinfo.py
==============================================================================
--- lxml/branch/lxml-1.2/setupinfo.py (original)
+++ lxml/branch/lxml-1.2/setupinfo.py Tue Feb 27 10:24:39 2007
@@ -24,7 +24,12 @@
print ("NOTE: Trying to build without Pyrex, pre-generated "
"'src/lxml/etree.c' needs to be available.")
source_extension = ".c"
-
+
+ if OPTION_WITHOUT_OBJECTIFY:
+ modules = [ entry for entry in EXT_MODULES if entry[0] != 'objectify' ]
+ else:
+ modules = EXT_MODULES
+
_include_dirs = include_dirs(static_include_dirs)
_library_dirs = library_dirs(static_library_dirs)
_cflags = cflags(static_cflags)
@@ -37,7 +42,7 @@
runtime_library_dirs = []
result = []
- for module, package in EXT_MODULES:
+ for module, package in modules:
result.append(
Extension(
package,
@@ -136,6 +141,7 @@
return False
# pick up any commandline options
+OPTION_WITHOUT_OBJECTIFY = has_option('without-objectify')
OPTION_WITHOUT_ASSERT = has_option('without-assert')
OPTION_WITHOUT_THREADING = has_option('without-threading')
OPTION_STATIC = has_option('static')
Modified: lxml/branch/lxml-1.2/src/lxml/ElementInclude.py
==============================================================================
--- lxml/branch/lxml-1.2/src/lxml/ElementInclude.py (original)
+++ lxml/branch/lxml-1.2/src/lxml/ElementInclude.py Tue Feb 27 10:24:39 2007
@@ -45,8 +45,7 @@
# Limited XInclude support for the ElementTree package.
##
-import copy
-from lxml import etree
+import copy, etree
try:
set
Modified: lxml/branch/lxml-1.2/src/lxml/etree_defs.h
==============================================================================
--- lxml/branch/lxml-1.2/src/lxml/etree_defs.h (original)
+++ lxml/branch/lxml-1.2/src/lxml/etree_defs.h Tue Feb 27 10:24:39 2007
@@ -47,6 +47,12 @@
#define HTML_PARSE_RECOVER XML_PARSE_RECOVER
#endif
+/* work around MSDEV 6.0 */
+#if (_MSC_VER == 1200) && (WINVER < 0x0500)
+extern "C" long _ftol( double ); //defined by VC6 C libs
+extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
+#endif
+
/* Redefinition of some Python builtins as C functions */
#define isinstance(o,c) PyObject_IsInstance(o,c)
#define issubclass(c,csuper) PyObject_IsSubclass(c,csuper)
Modified: lxml/branch/lxml-1.2/src/lxml/objectify.pyx
==============================================================================
--- lxml/branch/lxml-1.2/src/lxml/objectify.pyx (original)
+++ lxml/branch/lxml-1.2/src/lxml/objectify.pyx Tue Feb 27 10:24:39 2007
@@ -289,7 +289,13 @@
cdef tree.xmlNode* c_parent
cdef tree.xmlNode* c_node
if python._isString(key):
- self.__setattr__(key, value)
+ key = _buildChildTag(self, key)
+ try:
+ element = _lookupChild(self, key)
+ except AttributeError:
+ _appendValue(self, key, value)
+ else:
+ _replaceElement(element, value)
return
c_self_node = self._c_node
@@ -493,7 +499,7 @@
def __repr__(self):
return textOf(self._c_node) or ''
- def __setText(self, s):
+ def _setText(self, s):
"""For use in subclasses only. Don't use unless you know what you are
doing.
"""
@@ -1130,7 +1136,7 @@
cdef object __MATCH_PATH_SEGMENT
__MATCH_PATH_SEGMENT = re.compile(
- r"(\.?)\s*(?:\{([^}]*)\})?\s*(\w+)\s*(?:\[\s*([-0-9]+)\s*\])?",
+ r"(\.?)\s*(?:\{([^}]*)\})?\s*([^.{}\[\]\s]+)\s*(?:\[\s*([-0-9]+)\s*\])?",
re.U).match
cdef _parseObjectPathString(path):
Modified: lxml/branch/lxml-1.2/src/lxml/parser.pxi
==============================================================================
--- lxml/branch/lxml-1.2/src/lxml/parser.pxi (original)
+++ lxml/branch/lxml-1.2/src/lxml/parser.pxi Tue Feb 27 10:24:39 2007
@@ -662,7 +662,7 @@
"""
def __init__(self, attribute_defaults=False, dtd_validation=False,
load_dtd=False, no_network=False, ns_clean=False,
- recover=False, remove_blank_text=False, compact=False):
+ recover=False, remove_blank_text=False, compact=True):
cdef int parse_options
_BaseParser.__init__(self)
@@ -683,8 +683,8 @@
parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
if remove_blank_text:
parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
- if compact:
- parse_options = parse_options | xmlparser.XML_PARSE_COMPACT
+ if not compact:
+ parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
self._parse_options = parse_options
@@ -788,7 +788,7 @@
modify documents that were parsed with the 'compact' option.
"""
def __init__(self, recover=True, no_network=False, remove_blank_text=False,
- compact=False):
+ compact=True):
cdef int parse_options
_BaseParser.__init__(self)
@@ -799,8 +799,8 @@
parse_options = parse_options | htmlparser.HTML_PARSE_NONET
if remove_blank_text:
parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
- if compact:
- parse_options = parse_options | htmlparser.HTML_PARSE_COMPACT
+ if not compact:
+ parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
self._parse_options = parse_options
Modified: lxml/branch/lxml-1.2/src/lxml/sax.py
==============================================================================
--- lxml/branch/lxml-1.2/src/lxml/sax.py (original)
+++ lxml/branch/lxml-1.2/src/lxml/sax.py Tue Feb 27 10:24:39 2007
@@ -1,5 +1,5 @@
from xml.sax.handler import ContentHandler
-from lxml.etree import ElementTree, Element, SubElement, LxmlError
+from etree import ElementTree, Element, SubElement, LxmlError
class SaxError(LxmlError):
pass
Modified: lxml/branch/lxml-1.2/src/lxml/tests/test_objectify.py
==============================================================================
--- lxml/branch/lxml-1.2/src/lxml/tests/test_objectify.py (original)
+++ lxml/branch/lxml-1.2/src/lxml/tests/test_objectify.py Tue Feb 27 10:24:39 2007
@@ -208,6 +208,37 @@
self.assertEquals(["TEST"],
[ c.text for c in root.c ])
+ def test_setitem_string(self):
+ # make sure strings are set as children
+ Element = self.Element
+ SubElement = self.etree.SubElement
+ root = Element("root")
+ root["c"] = "TEST"
+ self.assertEquals(["TEST"],
+ [ c.text for c in root.c ])
+
+ def test_setitem_string_special(self):
+ # make sure 'text' etc. are set as children
+ Element = self.Element
+ SubElement = self.etree.SubElement
+ root = Element("root")
+
+ root["text"] = "TEST"
+ self.assertEquals(["TEST"],
+ [ c.text for c in root["text"] ])
+
+ root["tail"] = "TEST"
+ self.assertEquals(["TEST"],
+ [ c.text for c in root["tail"] ])
+
+ root["pyval"] = "TEST"
+ self.assertEquals(["TEST"],
+ [ c.text for c in root["pyval"] ])
+
+ root["tag"] = "TEST"
+ self.assertEquals(["TEST"],
+ [ c.text for c in root["tag"] ])
+
def test_findall(self):
XML = self.XML
root = XML('<a><b><c/></b><b/><c><b/></c></a>')
More information about the lxml-checkins
mailing list