From 7af203e8e346ae3b8bedd45e92dc4aa25b19cb7d Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sat, 26 Mar 2016 16:49:28 +0100 Subject: [PATCH] [util.strings] add parameterize() --- src/you_get/util/strings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/you_get/util/strings.py b/src/you_get/util/strings.py index a81cc15c..26d55594 100644 --- a/src/you_get/util/strings.py +++ b/src/you_get/util/strings.py @@ -23,3 +23,6 @@ from .fs import legitimize def get_filename(htmlstring): return legitimize(unescape_html(htmlstring)) + +def parameterize(string): + return "'%s'" % string.replace("'", r"'\''")