scrapy.utils.markup.remove_tags - python examples

Here are the examples of the python api scrapy.utils.markup.remove_tags taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : clean.py
Copyright GNU General Public License v3.0
Author : aplanas
    def _clean_field_str(self, field, clean_html=False,
                         optional=False, max_length=None):
        """Generic clean method for string field."""
        value = self._as_str(field)
        if max_length:
            value = value[:max_length]
        if clean_html:
            value = replace_ensaties(remove_tags(value))
        if not value and not optional:
            raise ValueError('field is not optional'
                             " or can't be converted to a string")
        return value