Scrapy, a fast high-level web crawling & scraping framework for Python.
rolled back public ent_re to private and added a function has_entities instead
Damian Canabalf8f2f3a542e6
diff --git a/scrapy/trunk/scrapy/utils/markup.py b/scrapy/trunk/scrapy/utils/markup.pyindex 87c4a3c02..2faf5e2b9 100644--- a/scrapy/trunk/scrapy/utils/markup.py+++ b/scrapy/trunk/scrapy/utils/markup.py@@ -5,7 +5,7 @@ Functions for dealing with markup textimport reimport htmlentitydefs-ent_re = re.compile(r'&(#?)([^&;]+);')+_ent_re = re.compile(r'&(#?)([^&;]+);')_tag_re = re.compile(r'<[a-zA-Z\/!].*?>', re.DOTALL)def remove_entities(text, keep=(), remove_illegal=True):@@ -45,8 +45,10 @@ def remove_entities(text, keep=(), remove_illegal=True):else:return u'&%s;' % m.group(2)- return ent_re.sub(convert_entity, text.decode('utf-8'))+ return _ent_re.sub(convert_entity, text.decode('utf-8'))+def has_entities(text):+ return bool(_ent_re.search(text))def replace_tags(text, token=''):"""Replace all markup tags found in the given text by the given token. By