[ZPT] HTMLParser changes introduce Python2 dependency

Tres Seaver tseaver@zope.com
Thu, 27 Sep 2001 00:25:36 -0400


The latest version of TAL/HTMLParser.py can't be used under
Python 1.5.2, as it swaps out regular expression matching for
the (admittedly faster) 'startswith' primitive on the HTML
comment strings:

<http://cvs.zope.org/Packages/TAL/HTMLParser.py?rev=1.19&content-type=text/vnd.viewcvs-markup>

Would a patch using string.find() be acceptable?  E.g., replace::

   elif rawdata.startswith("<!--", i): # <!--

with::

   elif sfind( rawdata, "<!--", i) == -1: # <!--

where sfind is a locally-bound name for 'string.find'?

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com