[Lxml-checkins] r46512 - lxml/trunk/src/lxml

scoder at codespeak.net scoder at codespeak.net
Wed Sep 12 21:53:25 CEST 2007


Author: scoder
Date: Wed Sep 12 21:53:24 2007
New Revision: 46512

Modified:
   lxml/trunk/src/lxml/objectify.pyx
Log:
support external parser in objectify.fromstring()

Modified: lxml/trunk/src/lxml/objectify.pyx
==============================================================================
--- lxml/trunk/src/lxml/objectify.pyx	(original)
+++ lxml/trunk/src/lxml/objectify.pyx	Wed Sep 12 21:53:24 2007
@@ -1568,12 +1568,15 @@
 cdef object _fromstring
 _fromstring = etree.fromstring
 
-def fromstring(xml):
-    """Objectify specific version of the lxml.etree fromstring() function.
+def fromstring(xml, parser=None):
+    """Objectify specific version of the lxml.etree fromstring() function
+    that uses the objectify parser.
 
-    NOTE: requires parser based element class lookup activated in lxml.etree!
+    You can pass a different parser as second argument.
     """
-    return _fromstring(xml, objectify_parser)
+    if parser is None:
+        parser = objectify_parser
+    return _fromstring(xml, parser)
 
 XML = fromstring
 


More information about the lxml-checkins mailing list