[Lxml-checkins] r44755 - lxml/branch/html/src/lxml/html

scoder at codespeak.net scoder at codespeak.net
Thu Jul 5 21:49:31 CEST 2007


Author: scoder
Date: Thu Jul  5 21:49:31 2007
New Revision: 44755

Modified:
   lxml/branch/html/src/lxml/html/__init__.py
Log:
small optimisation

Modified: lxml/branch/html/src/lxml/html/__init__.py
==============================================================================
--- lxml/branch/html/src/lxml/html/__init__.py	(original)
+++ lxml/branch/html/src/lxml/html/__init__.py	Thu Jul  5 21:49:31 2007
@@ -449,8 +449,8 @@
 _local_transforms.pretty_html_transform = etree.XSLT(etree.XML(_pretty_html_xsl))
 
 # This isn't a general match, but it's a match for what XSLT specifically creates:
-_meta_content_type_re = re.compile(
-    r'<meta http-equiv="Content-Type".*?>')
+__replace_meta_content_type = re.compile(
+    r'<meta http-equiv="Content-Type".*?>').sub
 
 def tostring(doc, pretty=False, include_meta_content_type=False):
     """
@@ -473,5 +473,5 @@
             html_transform = _local_transforms.html_transform = etree.XSLT(etree.XML(_html_xsl))
         html = str(html_transform(doc))
     if not include_meta_content_type:
-        html = _meta_content_type_re.sub('', html)
+        html = __replace_meta_content_type('', html)
     return html


More information about the lxml-checkins mailing list