aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/odict.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-04-02 14:38:33 +0200
committerMaximilian Hils <git@maximilianhils.com>2016-04-02 14:38:33 +0200
commit806aa0f41c7816b2859a6961939ed19499b73fe7 (patch)
tree069ce4a304fe3fab07def4a5daa3068c0140f2d8 /netlib/odict.py
parent4ee8808b44c5a3377ac2c1dfc4ba5fb10d559ef5 (diff)
downloadmitmproxy-806aa0f41c7816b2859a6961939ed19499b73fe7.tar.gz
mitmproxy-806aa0f41c7816b2859a6961939ed19499b73fe7.tar.bz2
mitmproxy-806aa0f41c7816b2859a6961939ed19499b73fe7.zip
improve .replace() and move it into netlib
Diffstat (limited to 'netlib/odict.py')
-rw-r--r--netlib/odict.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/netlib/odict.py b/netlib/odict.py
index 1e6e381a..461192f7 100644
--- a/netlib/odict.py
+++ b/netlib/odict.py
@@ -1,18 +1,8 @@
from __future__ import (absolute_import, print_function, division)
-import re
import copy
import six
-from .utils import Serializable
-
-
-def safe_subn(pattern, repl, target, *args, **kwargs):
- """
- There are Unicode conversion problems with re.subn. We try to smooth
- that over by casting the pattern and replacement to strings. We really
- need a better solution that is aware of the actual content ecoding.
- """
- return re.subn(str(pattern), str(repl), target, *args, **kwargs)
+from .utils import Serializable, safe_subn
class ODict(Serializable):