From 70f94c7171cac9659feccfb0f974f72d4bc33a80 Mon Sep 17 00:00:00 2001 From: arjun23496 Date: Fri, 26 Aug 2016 21:23:37 +0530 Subject: Added count argument for replace for contents in body --- netlib/http/message.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'netlib') diff --git a/netlib/http/message.py b/netlib/http/message.py index ce92bab1..b84f45c5 100644 --- a/netlib/http/message.py +++ b/netlib/http/message.py @@ -260,7 +260,7 @@ class Message(basetypes.Serializable): if "content-encoding" not in self.headers: raise ValueError("Invalid content encoding {}".format(repr(e))) - def replace(self, pattern, repl, flags=0): + def replace(self, pattern, repl, flags=0, count=0): """ Replaces a regular expression pattern with repl in both the headers and the body of the message. Encoded body will be decoded @@ -276,7 +276,7 @@ class Message(basetypes.Serializable): replacements = 0 if self.content: self.content, replacements = re.subn( - pattern, repl, self.content, flags=flags + pattern, repl, self.content, flags=flags, count=count ) replacements += self.headers.replace(pattern, repl, flags) return replacements -- cgit v1.2.3