From da7b9358a4973b44859433c11377c888d559361e Mon Sep 17 00:00:00 2001 From: Ismael Carnales Date: Thu, 7 May 2009 16:03:41 +0000 Subject: [PATCH] updated docstrings for remove_escape_chars and its adaptor factory --- scrapy/contrib_exp/adaptors/markup.py | 8 ++++---- scrapy/utils/markup.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scrapy/contrib_exp/adaptors/markup.py b/scrapy/contrib_exp/adaptors/markup.py index b8f29d3ed..13a6f16de 100644 --- a/scrapy/contrib_exp/adaptors/markup.py +++ b/scrapy/contrib_exp/adaptors/markup.py @@ -31,20 +31,20 @@ def remove_root(value): return str_to_unicode(value) -def remove_escape(which_ones=('\n','\t','\r'), replace_str=u''): +def remove_escape(which_ones=('\n','\t','\r'), replace_by=u''): """ Factory that returns an adaptor for removing/replacing each escape character in the `wich_ones` parameter found in the given value. - If `replace_str` is given, escape characters are replaced by that - string, else they're removed. + If `replace_by` is given, escape characters are replaced by that + text, else they're removed. Input: string/unicode Output: unicode """ def _remove_escape(value): - return remove_escape_chars(value, which_ones, replace_str) + return remove_escape_chars(value, which_ones, replace_by) return _remove_escape diff --git a/scrapy/utils/markup.py b/scrapy/utils/markup.py index 9a9786072..fd6e1dc25 100644 --- a/scrapy/utils/markup.py +++ b/scrapy/utils/markup.py @@ -110,6 +110,9 @@ def remove_escape_chars(text, which_ones=('\n','\t','\r'), replace_by=u''): which_ones -- is a tuple of which escape chars we want to remove. By default removes \n, \t, \r. + + replace_by -- text to replace the escape chars for. + It defaults to '', so the escape chars are removed. """ for ec in which_ones: text = text.replace(ec, str_to_unicode(replace_by))